Move a Google Apps Script web app off Google Sheets and onto a real Postgres database. You will create a Supabase project, store the URL and key in Code.gs, build a table in the SQL Editor and deploy a web app with working add, edit and delete. It suits beginners who already have a two-file Apps Script project.
YouTube video: Supabase + Google Apps Script: Real Database in 2 Files
Caption availability is unknown. Check the CC control in the YouTube player.
Choose a chapter (15)
- Video length
- 9 min 15 s
- Time to do it
- 45 minutes
- Difficulty
- Medium
- Steps
- 7
What you need
Steps
Sign in at supabase.com and create a new project. Give it a name, set a database password and pick the region closest to your users, then wait a minute or two for setup to finish.
Open Project Settings, then API. Copy the Project URL and the publishable (anon) key. You will paste both into your script.
Open your Apps Script project with Code.gs and index.html. Ask ChatGPT for functions that call the Supabase REST endpoint with UrlFetchApp.fetch, sending the apikey and Authorization headers for add, edit and delete.
Paste the URL and key into the constants at the top of Code.gs. Keep the key out of index.html so it never reaches the browser.
In the Supabase SQL Editor, run a CREATE TABLE statement that matches your form fields. Add an id column with a default and a created_at timestamp.
Deploy the script as a web app, set Execute as to yourself and Who has access to anyone. Open the URL and test adding, editing and deleting a row.
Break the key on purpose by changing one character in Code.gs. Reload the app and confirm the request fails, which proves the data comes from Supabase, not Sheets.
Tips and common mistakes
Store the secret service key in Script Properties instead of hardcoding it in Code.gs.
Send the apikey header on every request, or Supabase returns a 401 error and nothing saves.
Free Supabase projects pause when idle, so open the dashboard and wake the project before a demo.
Turn on Row Level Security for the table once your app is public so strangers cannot wipe rows.
Questions
Do I need a paid Supabase plan?
No. The free plan gives you a Postgres database and REST API, which is enough to build and test. Upgrade only if your app outgrows the free limits.
Where do I find the project URL and key?
In the Supabase dashboard, open Project Settings and then API. The Project URL and the publishable or anon key sit near the top of that page.
Can I keep using Google Sheets too?
Yes, but pick one source of truth. Keep Sheets as a backup or reporting copy and let Supabase handle the live reads and writes.
The notes are drafted automatically from video details and general task knowledge. How the guide was prepared
Report a correction


