️ Update a Google Spreadsheet via GET requests with Google Apps Script
Programmatically update a Google Spreadsheet (you own) via HTTP GET
requests.
- Open a Google Spreadsheet
- On the menu bar, click on "Tools" > "Script Editor"
- Copy and paste the contents of
index.gs
- Save the file and project
- On the menu bar, click on "Publish" > "Deploy as web app..."
- Ensure "Execute the app as" and "Who has access to the app" are setup correctly. Choose
Me
andAnyone, even anonymous
for the most permissive authorization. - Click the "Deploy" button
Let's pretend our web app URL is https://script.google.com/macros/s/.../exec
Scenario A: Update the b2
cell with the value food
of the first sheet on my spreadsheet.
https://script.google.com/macros/s/.../exec?sheet=1&cell=b2&value=food
Scenario B: Update cells c1
, c2
and c3
with the values 10
, 20
and 50
(respectively) of the second sheet on my spreadsheet.
https://script.google.com/macros/s/.../exec?sheet=2&cell=c1&cell=c2&cell=c3&value=10&value=20&value=50
Type: number
The number of the sheet where the cells are being updated. Must be 1
or greater.
Type: string
The name(s) of the cell(s) being updated.
Type: string
The value(s) for the cell(s) being updated.
MIT © Alejandro Beltrán