google_sheet_update Function
Syntax
C result = google_sheet_update(C spreadsheetId, C values, C range)
Arguments
- spreadsheetIdCharacter
The id of the Google Sheet to update.
- valuesCharacter
A JSON string containing an array of JSON objects to write into the sheet.
- rangeCharacter
The top-left cell where data should be written. For example: Sheet1!H1
When updating a Google Sheet, the range need only specify the starting cell. For example: Sheet1!A1
Returns
- resultCharacter
Returns a response string from the update request.
If spreadsheetId is blank, the function returns the service account email address that the sheet must be shared with.
Description
Updates a Google Sheet by writing JSON data to the specified range.
Important
Before you can use this function with your Google Sheet, you must first share the sheet with this email address:
sheets@sheets-448303.iam.gserviceaccount.com
You can get this email address by calling google_sheet_update() with a blank id. For example:
google_sheet_update("","","")Spreadsheet Id
The Sheet id is obtained by taking the address shown in the browser when you have the sheet open and then extracting the id from the URL:
https://docs.google.com/spreadsheets/d/this_is_the_id/edit?gid=0#gid=0
Example
dim id as c = "1klxbQOgMiE1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ' Create a JSON array of objects to write to the sheet dim p[2] as p p[1].company = "alpha" p[2].company = "beta" dim json as c json = json_generate(p) ' Write starting at cell A1 google_sheet_update(id,json,"Sheet1!A1")
See Also