Lesson summary
Convert Google Sheets into a REST API
Learn Google Sheets & Excel Spreadsheets
What this is
A walkthrough of turning a private Google Sheet into a REST API with Google Apps Script. External web forms and services can read and write data without making the sheet public or granting third parties direct sheet access.
Who it is for
Spreadsheet creators, developers, and no-code builders who want to use Google Sheets as a backend database or API endpoint.
What you will be able to do
Build a WORKOUTS log plus a SUMMARY total, implement doPost and doGet, deploy the script as a web app, test writes and reads, pull the live total into another sheet, and submit entries from a simple online form.
Takeaways
- You do not have to share the sheet or set it to “Anyone with the link.” The web app talks to the sheet while the file stays private.
doPost(e)is for data entry. Read URL parameters such ascountandtypefrome.parameter, insert a new top row, and write the values.doGet(e)is for reading. Fetch a cell (here,SUMMARY!B1) withgetValue()and return it as HTTP text withContentService.createTextOutput().- Successful writes can return an explicit HTTP 200 via
ContentService.createTextOutput(200). - Deploy as a Web App: Execute as “Me,” Who has access “Anyone.” Authorize once.
- After you change the script, create a new deployment so you get a working URL. The video hits a method-name typo (
insertRowsBeforevsinsertRowBefore) and shows this re-deploy step. - No-code tools such as Carrd can POST to the same URL if field IDs match the script parameters (
count,type). - A second Google account can pull the live total with
=IMPORTDATA()pointed at the GET URL.
In the video
- Overview: turning Google Sheets into a REST API
- Setting up the WORKOUTS and SUMMARY sheets
- Opening Apps Script and defining doGet and doPost
- Coding doPost to insert workout rows
- Returning an HTTP 200 response
- Deploying Apps Script as a web app
- Testing POST requests with Postman
- Fixing insertRowBefore and redeploying
- Coding and deploying doGet to return total pushups
- Fetching API data with =IMPORTDATA() in another sheet
- Building a public Carrd.co form to post workouts
- Testing the Carrd form into the sheet
- Conclusion and course references