bigfunctions > upload_to_gsheet
upload_to_gsheet¶
Signature
upload_to_gsheet(data, spreadsheet_url, worksheet_name, write_mode)
Description
Upload data
(a json array of objects) to a Google Sheet
in write_mode
.
- 💡 For this to work, share your Google Sheet in edit mode to
749389685934-compute@developer.gserviceaccount.com
write_mode
controls what is done if a worksheet withworksheet_name
already exists. It must be one of:
write_truncate
: if the sheet already exists, it will be recreated.write_append
: if the sheet already exists, data will be appended to it.raise_error
: if the sheet already exists, an error will be raised.do_nothing
: if the sheet already exists, nothing will be done.null
: same aswrite_truncate
Examples
select bigfunctions.eu.upload_to_gsheet(json '[{"col1": "row1", "col2": 1}, {"col1": "row2", "col2": 2}]', "https://docs.google.com/spreadsheets/d/xxxxxxxxx", "my worksheet", "write_truncate")
select bigfunctions.us.upload_to_gsheet(json '[{"col1": "row1", "col2": 1}, {"col1": "row2", "col2": 2}]', "https://docs.google.com/spreadsheets/d/xxxxxxxxx", "my worksheet", "write_truncate")
select bigfunctions.europe_west1.upload_to_gsheet(json '[{"col1": "row1", "col2": 1}, {"col1": "row2", "col2": 2}]', "https://docs.google.com/spreadsheets/d/xxxxxxxxx", "my worksheet", "write_truncate")
+---------------+
| result |
+---------------+
| DATA_UPLOADED |
+---------------+