If clicking "Audit Selected Formulas" or "Upload Policy Document" does nothing, follow these steps:
- Open your Google Sheet
- Open Extensions → Apps Script
- In the Apps Script editor, click View → Logs (or press Ctrl+Enter after running)
- Go back to your sheet and click the buttons
- Return to Apps Script → Executions (clock icon on left sidebar)
- Look for error messages
- In your Google Sheet, press F12 (or right-click → Inspect)
- Go to Console tab
- Click the buttons in the sidebar
- Look for error messages like:
google.script.run is not definedReferenceError: runAudit is not defined- Permission errors
The buttons might not work if Apps Script doesn't have permission:
- Go to Extensions → Apps Script
- Click Run (
▶️ ) button → SelectonOpenfunction - Click Review permissions
- Choose your Google account
- Click Advanced → Go to SheetBrain AI (unsafe)
- Click Allow
- Close Apps Script editor
- Refresh your Google Sheet (F5)
- The "SheetBrain AI" menu should appear
- Click SheetBrain AI → Open Audit Panel
- Try clicking the buttons again
In Apps Script editor, check that these functions exist:
function onOpen() { ... }
function showSidebar() { ... }
function getAuditResults() { ... }
function getBillingInfo() { ... }
function uploadPolicy(fileName, content) { ... }If any are missing, copy the entire apps-script-standalone-enhanced.js file again.
Open PowerShell and test:
# Test health endpoint
curl https://sheetbrain-ai.vercel.app/api/health
# Test auth endpoint
$body = @{
userId = "test-user"
email = "test@example.com"
orgId = "test-org"
role = "editor"
} | ConvertTo-Json
Invoke-RestMethod -Method POST -Uri "https://sheetbrain-ai.vercel.app/api/auth/debug-login" -Body $body -ContentType "application/json"Expected: Should see {"status":"ok"} and a JWT token.
The 500 error happens when database tables don't exist:
- Go to Supabase Dashboard
- Select your project
- Click Table Editor (left sidebar)
- Verify these 9 tables exist:
- ✅ organizations
- ✅ users
- ✅ subscriptions
- ✅ audit_usage
- ✅ rate_limit_buckets
- ✅ policies
- ✅ audit_logs
- ✅ ingestion_logs
- ✅ embeddings
If tables are missing:
- Click SQL Editor
- Copy all content from
backend/src/lib/db/schema.sql - Paste and click Run
If buttons still don't work, test functions manually:
- Select a cell with a formula (e.g.,
=SUM(A1:A10)) - In Apps Script editor, click Run → Select
getAuditResults - Check Executions for results
- Look for errors in the logs
| Issue | Symptom | Fix |
|---|---|---|
| Not authorized | "Authorization required" popup | Run onOpen, grant permissions |
| 500 error | "Audit failed: Backend error (500)" | Deploy database schema to Supabase |
| No cells selected | "No cells selected" message | Select cells with formulas BEFORE opening sidebar |
| Buttons greyed out | Can't click buttons | Refresh page, reauthorize permissions |
| Loading forever | Spinner never stops | Check backend is live (curl health endpoint) |
| Popup blocked | No prompt appears | Allow popups for sheets.google.com |
To see what's happening, check the browser console (F12):
You should see:
SheetBrain AI script loaded
Window loaded, initializing...
Loading plan info...
Audit button listener attached
Upload button listener attached
All event listeners attached
When you click Audit:
Audit triggered
Calling getAuditResults...
Audit response: {...}
- In cell A1, enter:
=1+1 - Select cell A1
- Open SheetBrain AI → Open Audit Panel
- Click Audit Selected Formulas
- Should see: "Total Formulas: 1"
Check Vercel has all required keys:
CLERK_SECRET_KEY=sk_test_xxxxx
DATABASE_URL=postgresql://...
OPENROUTER_API_KEY=sk-or-xxxxx
OPENAI_API_KEY=sk-xxxxx
STRIPE_API_KEY=sk_test_xxxxxMissing keys → Backend fails → Buttons don't work.
- Copied latest
apps-script-standalone-enhanced.jsto Code.gs - Ran
onOpenfunction and granted permissions - Refreshed Google Sheet (F5)
- SheetBrain AI menu appears
- Opened sidebar via menu
- Selected cells with formulas
- Checked browser console (F12) for errors
- Verified backend is live (curl health endpoint)
- Deployed database schema to Supabase
- Tested with simple formula (=1+1)
- Clear cache: Ctrl+Shift+Delete → Clear browsing data
- Try incognito: Open sheet in incognito/private mode
- Different browser: Test in Chrome if using Firefox
- Re-deploy: Delete Code.gs, paste fresh code, reauthorize
- Check status: https://status.google.com/appstatus (Apps Script issues)
✅ Working correctly:
- Console shows "SheetBrain AI script loaded"
- Console shows "Audit button listener attached"
- Clicking audit shows "Audit triggered"
- Backend returns results (not 500 error)
- Plan info loads: "FREE Plan" or usage stats
❌ Not working:
- No console messages when clicking buttons
- "google.script.run is not defined" error
- "Authorization required" popup on every click
- Buttons are greyed out
- Sidebar is blank/white
If still having issues, check:
- GitHub Issues: https://github.com/yocho1/SheetBrain-AI/issues
- Backend Status: https://sheetbrain-ai.vercel.app/api/health
- Supabase Status: Check project dashboard
Last Updated: January 4, 2026