Loopfour
Integrations

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 the spreadsheets and drive.file scopes.
  • Pin an account with config.connection. Without it, the step uses the company's default Google Sheets connection.

Actions

Action idStudio labelWhat it does
google-sheets.addSheetAdd SheetAdd a new sheet (tab) to a spreadsheet.
google-sheets.appendValuesAppend ValuesAppend rows after the last row of the table that contains the range.
google-sheets.batchClearValuesBatch Clear ValuesClear several A1 ranges, keeping formatting.
google-sheets.batchClearValuesByDataFilterBatch Clear Values by Data FilterClear the ranges matched by data filters, keeping formatting.
google-sheets.batchGetValuesBatch Get ValuesRead several A1 ranges in one call.
google-sheets.batchGetValuesByDataFilterBatch Get Values by Data FilterRead the ranges matched by data filters.
google-sheets.batchUpdateSpreadsheetBatch Update SpreadsheetApply raw Sheets API Request objects in one atomic call (formatting, dimensions, charts, protected ranges, and anything without a named action).
google-sheets.clearValuesClear ValuesClear the values of an A1 range, keeping formatting.
google-sheets.copySheetCopy SheetCopy one sheet into another spreadsheet.
google-sheets.createSpreadsheetCreate SpreadsheetCreate a new spreadsheet in the connected account's Drive.
google-sheets.getSpreadsheetGet SpreadsheetRead spreadsheet metadata and the list of sheets (no cell data).
google-sheets.getSpreadsheetByDataFilterGet Spreadsheet by Data FilterRead the spreadsheet, limited to the ranges matched by data filters.
google-sheets.insertColumnInsert ColumnInsert one empty column at a zero-based index.
google-sheets.readValuesRead ValuesRead the cell values of one A1 range.
google-sheets.searchDeveloperMetadataSearch Developer MetadataFind developer metadata entries matching data filters.
google-sheets.updateConditionalFormatRuleUpdate Conditional Format RuleReplace or reorder a conditional format rule by index.
google-sheets.updateValuesUpdate ValuesOverwrite the cells of an A1 range with a 2-D matrix.
google-sheets.insertRowInsert RowInsert one row at a zero-based row index.
google-sheets.deleteSheetDelete SheetDelete a sheet by title. Cannot be undone.
google-sheets.upsertRowUpsert RowOverwrite the first row whose keyColumn equals keyValue, or append the row when none matches.

Settings

FieldStudio labelTypeUsed byRequired for
connectionGoogle Sheets Accountstring (connection id)AllOptional. Without it the step uses the company default connection for this system
spreadsheetIdSpreadsheet IDstringaddSheet, appendValues, batchClearValues, batchClearValuesByDataFilter, batchGetValues, batchGetValuesByDataFilter, batchUpdateSpreadsheet, clearValues, copySheet, getSpreadsheet, getSpreadsheetByDataFilter, insertColumn, readValues, searchDeveloperMetadata, updateConditionalFormatRule, updateValues, insertRow, deleteSheet, upsertRowaddSheet, appendValues, batchClearValues, batchClearValuesByDataFilter, batchGetValues, batchGetValuesByDataFilter, batchUpdateSpreadsheet, clearValues, copySheet, getSpreadsheet, getSpreadsheetByDataFilter, insertColumn, readValues, searchDeveloperMetadata, updateConditionalFormatRule, updateValues, insertRow, deleteSheet, upsertRow
rangeRangestringappendValues, clearValues, readValues, updateValues, upsertRowappendValues, clearValues, readValues, updateValues, upsertRow
titleSpreadsheet TitlestringcreateSpreadsheetcreateSpreadsheet
initialSheetTitlesInitial Sheet Titles (JSON)jsoncreateSpreadsheet
sheetTitleSheet TitlestringaddSheet, insertRow, deleteSheetaddSheet, deleteSheet
valuesValues (JSON)jsonappendValues, updateValuesappendValues, updateValues
rowValuesValues (JSON)jsoninsertRow, upsertRowinsertRow, upsertRow
rangesRanges (JSON)jsonbatchClearValues, batchGetValuesbatchClearValues, batchGetValues
dataFiltersData Filters (JSON)jsonbatchClearValuesByDataFilter, batchGetValuesByDataFilter, getSpreadsheetByDataFilter, searchDeveloperMetadatabatchClearValuesByDataFilter, batchGetValuesByDataFilter, getSpreadsheetByDataFilter, searchDeveloperMetadata
requestsRequests (JSON)jsonbatchUpdateSpreadsheetbatchUpdateSpreadsheet
ruleRule (JSON)jsonupdateConditionalFormatRule
majorDimensionMajor Dimensionstring: ROWS, COLUMNSappendValues, batchGetValues, batchGetValuesByDataFilter, readValues, updateValues
valueRenderOptionValue Render Optionstring: FORMATTED_VALUE, UNFORMATTED_VALUE, FORMULAbatchGetValues, batchGetValuesByDataFilter, readValues
dateTimeRenderOptionDate/Time Render Optionstring: SERIAL_NUMBER, FORMATTED_STRINGbatchGetValues, batchGetValuesByDataFilter, readValues
valueInputOptionValue Input Optionstring: RAW, USER_ENTEREDappendValues, updateValues, insertRow, upsertRow
insertDataOptionInsert Data Optionstring: INSERT_ROWS, OVERWRITEappendValues
includeValuesInResponseInclude Values in ResponsebooleanappendValues, updateValues
includeGridDataInclude Grid DatabooleangetSpreadsheetByDataFilter
includeSpreadsheetInResponseInclude Spreadsheet in ResponsebooleanbatchUpdateSpreadsheet
inheritFromBeforeInherit Formatting From Column BeforebooleaninsertColumn
rowCountRow CountnumberaddSheet
columnCountColumn CountnumberaddSheet
sheetIdSheet IdnumbercopySheet, insertColumn, updateConditionalFormatRule, insertRowcopySheet, insertColumn, insertRow
destinationSpreadsheetIdDestination Spreadsheet IdstringcopySheetcopySheet
localeLocalestringcreateSpreadsheet
timeZoneTime ZonestringcreateSpreadsheet
columnIndexColumn IndexnumberinsertColumninsertColumn
indexIndexnumberupdateConditionalFormatRuleupdateConditionalFormatRule
newIndexNew IndexnumberupdateConditionalFormatRule
rowIndexRow IndexnumberinsertRowinsertRow
keyColumnKey ColumnnumberupsertRow
keyValueKey ValuestringupsertRow

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 (for appendValues and updateValues) is a 2-D array, one inner array per row. rowValues (for insertRow and upsertRow) is one row, a flat array.
  • Writes default to RAW. Set valueInputOption to USER_ENTERED only when Google should parse formulas, dates or numbers.
  • Google allows 60 writes per minute per user. Put many rows in one appendValues call instead of one step per row.
  • getSpreadsheet returns the numeric sheetId that copySheet, insertRow and insertColumn need.

Upsert and insert

  • upsertRow reads range, finds the first row where column keyColumn (zero-based, inside the range) equals keyValue as text, and overwrites that row. When no row matches, or keyColumn is not set, it appends the row. keyValue is required when keyColumn is set. The output's upsertResult is updated or appended.
  • insertRow inserts an empty row at the zero-based rowIndex of the sheet with id sheetId, then writes rowValues into it. When you also pass sheetTitle, it must match the sheet's title or the step fails.
  • deleteSheet deletes the sheet named sheetTitle and returns deleted: 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

  • readValues returns spreadsheetId, range, majorDimension and values (an empty array when the range is blank). Cell values come back as formatted text unless you set valueRenderOption.
  • appendValues returns spreadsheetId, tableRange, updatedRange, updatedRows, updatedColumns and updatedCells.
  • createSpreadsheet returns spreadsheetId, spreadsheetUrl, title, locale, timeZone and sheets.

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-sheets returns the actions and fields.
  • GET /api/v1/blocks/google-sheets/actions/<operation>/examples returns stored input and output examples.

Errors and limits

  • Each Google call has a 30-second limit.
  • A missing required field or an unknown valueInputOption fails 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 deleteSheet and insertRow with "not found in spreadsheet".

On this page