Google Sheets actions
Reference for the Google Sheets actions: the Google connection, each action id, A1 ranges, value input options, row upserts, outputs and an example.
The Google Sheets block reads and writes cells, rows, tabs and spreadsheets. For the plain-language guide, see Google Sheets.
When to use it
Use it to read a working schedule into a workflow, append results such as a list of matched payments, or keep one row per record current with upsertRow. There is no Google Sheets trigger; start the workflow on a schedule, from the API or from another system's event.
Connection
- Provider id:
google-sheets. Google OAuth with thespreadsheetsanddrive.filescopes. - Pin an account with
config.connection. Without it, the step uses the company's default Google Sheets connection.
Actions
| Action id | Studio label | What it does |
|---|---|---|
google-sheets.addSheet | Add Sheet | Add a new sheet (tab) to a spreadsheet. |
google-sheets.appendValues | Append Values | Append rows after the last row of the table that contains the range. |
google-sheets.batchClearValues | Batch Clear Values | Clear several A1 ranges, keeping formatting. |
google-sheets.batchClearValuesByDataFilter | Batch Clear Values by Data Filter | Clear the ranges matched by data filters, keeping formatting. |
google-sheets.batchGetValues | Batch Get Values | Read several A1 ranges in one call. |
google-sheets.batchGetValuesByDataFilter | Batch Get Values by Data Filter | Read the ranges matched by data filters. |
google-sheets.batchUpdateSpreadsheet | Batch Update Spreadsheet | Apply raw Sheets API Request objects in one atomic call (formatting, dimensions, charts, protected ranges, and anything without a named action). |
google-sheets.clearValues | Clear Values | Clear the values of an A1 range, keeping formatting. |
google-sheets.copySheet | Copy Sheet | Copy one sheet into another spreadsheet. |
google-sheets.createSpreadsheet | Create Spreadsheet | Create a new spreadsheet in the connected account's Drive. |
google-sheets.getSpreadsheet | Get Spreadsheet | Read spreadsheet metadata and the list of sheets (no cell data). |
google-sheets.getSpreadsheetByDataFilter | Get Spreadsheet by Data Filter | Read the spreadsheet, limited to the ranges matched by data filters. |
google-sheets.insertColumn | Insert Column | Insert one empty column at a zero-based index. |
google-sheets.readValues | Read Values | Read the cell values of one A1 range. |
google-sheets.searchDeveloperMetadata | Search Developer Metadata | Find developer metadata entries matching data filters. |
google-sheets.updateConditionalFormatRule | Update Conditional Format Rule | Replace or reorder a conditional format rule by index. |
google-sheets.updateValues | Update Values | Overwrite the cells of an A1 range with a 2-D matrix. |
google-sheets.insertRow | Insert Row | Insert one row at a zero-based row index. |
google-sheets.deleteSheet | Delete Sheet | Delete a sheet by title. Cannot be undone. |
google-sheets.upsertRow | Upsert Row | Overwrite the first row whose keyColumn equals keyValue, or append the row when none matches. |
Settings
| Field | Studio label | Type | Used by | Required for |
|---|---|---|---|---|
connection | Google Sheets Account | string (connection id) | All | Optional. Without it the step uses the company default connection for this system |
spreadsheetId | Spreadsheet ID | string | addSheet, appendValues, batchClearValues, batchClearValuesByDataFilter, batchGetValues, batchGetValuesByDataFilter, batchUpdateSpreadsheet, clearValues, copySheet, getSpreadsheet, getSpreadsheetByDataFilter, insertColumn, readValues, searchDeveloperMetadata, updateConditionalFormatRule, updateValues, insertRow, deleteSheet, upsertRow | addSheet, appendValues, batchClearValues, batchClearValuesByDataFilter, batchGetValues, batchGetValuesByDataFilter, batchUpdateSpreadsheet, clearValues, copySheet, getSpreadsheet, getSpreadsheetByDataFilter, insertColumn, readValues, searchDeveloperMetadata, updateConditionalFormatRule, updateValues, insertRow, deleteSheet, upsertRow |
range | Range | string | appendValues, clearValues, readValues, updateValues, upsertRow | appendValues, clearValues, readValues, updateValues, upsertRow |
title | Spreadsheet Title | string | createSpreadsheet | createSpreadsheet |
initialSheetTitles | Initial Sheet Titles (JSON) | json | createSpreadsheet | |
sheetTitle | Sheet Title | string | addSheet, insertRow, deleteSheet | addSheet, deleteSheet |
values | Values (JSON) | json | appendValues, updateValues | appendValues, updateValues |
rowValues | Values (JSON) | json | insertRow, upsertRow | insertRow, upsertRow |
ranges | Ranges (JSON) | json | batchClearValues, batchGetValues | batchClearValues, batchGetValues |
dataFilters | Data Filters (JSON) | json | batchClearValuesByDataFilter, batchGetValuesByDataFilter, getSpreadsheetByDataFilter, searchDeveloperMetadata | batchClearValuesByDataFilter, batchGetValuesByDataFilter, getSpreadsheetByDataFilter, searchDeveloperMetadata |
requests | Requests (JSON) | json | batchUpdateSpreadsheet | batchUpdateSpreadsheet |
rule | Rule (JSON) | json | updateConditionalFormatRule | |
majorDimension | Major Dimension | string: ROWS, COLUMNS | appendValues, batchGetValues, batchGetValuesByDataFilter, readValues, updateValues | |
valueRenderOption | Value Render Option | string: FORMATTED_VALUE, UNFORMATTED_VALUE, FORMULA | batchGetValues, batchGetValuesByDataFilter, readValues | |
dateTimeRenderOption | Date/Time Render Option | string: SERIAL_NUMBER, FORMATTED_STRING | batchGetValues, batchGetValuesByDataFilter, readValues | |
valueInputOption | Value Input Option | string: RAW, USER_ENTERED | appendValues, updateValues, insertRow, upsertRow | |
insertDataOption | Insert Data Option | string: INSERT_ROWS, OVERWRITE | appendValues | |
includeValuesInResponse | Include Values in Response | boolean | appendValues, updateValues | |
includeGridData | Include Grid Data | boolean | getSpreadsheetByDataFilter | |
includeSpreadsheetInResponse | Include Spreadsheet in Response | boolean | batchUpdateSpreadsheet | |
inheritFromBefore | Inherit Formatting From Column Before | boolean | insertColumn | |
rowCount | Row Count | number | addSheet | |
columnCount | Column Count | number | addSheet | |
sheetId | Sheet Id | number | copySheet, insertColumn, updateConditionalFormatRule, insertRow | copySheet, insertColumn, insertRow |
destinationSpreadsheetId | Destination Spreadsheet Id | string | copySheet | copySheet |
locale | Locale | string | createSpreadsheet | |
timeZone | Time Zone | string | createSpreadsheet | |
columnIndex | Column Index | number | insertColumn | insertColumn |
index | Index | number | updateConditionalFormatRule | updateConditionalFormatRule |
newIndex | New Index | number | updateConditionalFormatRule | |
rowIndex | Row Index | number | insertRow | insertRow |
keyColumn | Key Column | number | upsertRow | |
keyValue | Key Value | string | upsertRow |
spreadsheetId is the id in the sheet URL: /spreadsheets/d/<id>/edit.
Ranges and values
- Ranges are A1 notation. Quote a sheet title that has a space or apostrophe:
'Q3 Data'!A1:C10. values(forappendValuesandupdateValues) is a 2-D array, one inner array per row.rowValues(forinsertRowandupsertRow) is one row, a flat array.- Writes default to
RAW. SetvalueInputOptiontoUSER_ENTEREDonly when Google should parse formulas, dates or numbers. - Google allows 60 writes per minute per user. Put many rows in one
appendValuescall instead of one step per row. getSpreadsheetreturns the numericsheetIdthatcopySheet,insertRowandinsertColumnneed.
Upsert and insert
upsertRowreadsrange, finds the first row where columnkeyColumn(zero-based, inside the range) equalskeyValueas text, and overwrites that row. When no row matches, orkeyColumnis not set, it appends the row.keyValueis required whenkeyColumnis set. The output'supsertResultisupdatedorappended.insertRowinserts an empty row at the zero-basedrowIndexof the sheet with idsheetId, then writesrowValuesinto it. When you also passsheetTitle, it must match the sheet's title or the step fails.deleteSheetdeletes the sheet namedsheetTitleand returnsdeleted: true.
Irreversible actions
deleteSheet, clearValues, batchClearValues, batchClearValuesByDataFilter and batchUpdateSpreadsheet change the file for good. batchUpdateSpreadsheet takes raw Sheets API Request objects and can delete sheets, rows and ranges.
Output
readValuesreturnsspreadsheetId,range,majorDimensionandvalues(an empty array when the range is blank). Cell values come back as formatted text unless you setvalueRenderOption.appendValuesreturnsspreadsheetId,tableRange,updatedRange,updatedRows,updatedColumnsandupdatedCells.createSpreadsheetreturnsspreadsheetId,spreadsheetUrl,title,locale,timeZoneandsheets.
Read fields with {{steps.<stepId>.<path>}}, for example {{steps.read_accruals.values}}.
Example
Read the accruals tab, then add or update the row for one vendor. The caller passes vendorId and amount.
{
"name": "Update the accruals tracker",
"trigger": { "type": "api" },
"steps": [
{
"id": "read_accruals",
"type": "action",
"name": "Read accruals",
"action": "google-sheets.readValues",
"config": {
"spreadsheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
"range": "Accruals!A1:D200"
}
},
{
"id": "upsert_vendor",
"type": "action",
"name": "Add or update the vendor row",
"action": "google-sheets.upsertRow",
"config": {
"spreadsheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
"range": "Accruals!A2:D200",
"rowValues": ["{{input.vendorId}}", "{{input.amount}}", "{{run.id}}"],
"keyColumn": 0,
"keyValue": "{{input.vendorId}}",
"valueInputOption": "USER_ENTERED"
}
}
]
}Live catalog
GET /api/v1/blocks/google-sheetsreturns the actions and fields.GET /api/v1/blocks/google-sheets/actions/<operation>/examplesreturns stored input and output examples.
Errors and limits
- Each Google call has a 30-second limit.
- A missing required field or an unknown
valueInputOptionfails the step before Google is called. Google errors fail the step with Google's message. - A sheet title or id that is not in the spreadsheet fails
deleteSheetandinsertRowwith "not found in spreadsheet".
Email actions
Reference for the Send Email, Gmail and Outlook actions: step types, connections, each action id, the fields each executor reads, outputs and an example.
HubSpot actions
Reference for the HubSpot actions and trigger: the sign-in connection, each action id, the registered events, the fields each action reads and an example.
Loopfour