Google Sheets
The Google Sheets action lets tasks create, read, write, and manage Google Sheets spreadsheets. Mechanic interacts with Google Sheets via the Google Sheets API, using OAuth2 for authentication β see Authentication.
Due to Google security restrictions, Mechanic can only access spreadsheets that were created through Mechanic itself β no other spreadsheets in your drive. To work with Google Sheets:
First create a spreadsheet using the
"create_spreadsheet"operationStore the returned spreadsheet ID for later use
Then use the other operations on this spreadsheet
See this great example in the task library.
Operations
Create a spreadsheet, with one or many named sheets
Add rows to the end of a sheet's data
Overwrite rows at a specific range
Clear a range, or a whole sheet
Read values into the action result
Delete a span of rows (rows below shift up)
Add a sheet (tab) to an existing spreadsheet
Rename a sheet (tab)
Delete a sheet (tab)
Export the spreadsheet as XLSX, CSV, PDF, HTML, ODS, or TSV
Every operation requires "account" (the email address of a connected Google account), and every operation except create_spreadsheet requires "spreadsheet_id". Each operation's remaining options are listed in its section below.
Targeting sheets and ranges
These conventions apply across the operations:
sheet_nametargets a sheet (tab) by its exact name. Where it's optional (append_rows,update_rows,clear_values,get_values), omitting it targets the spreadsheet's first sheet β Mechanic looks up the actual name, so language-specific defaults ("Sheet1", "Foglio1", "Hoja1", β¦) are handled automatically. Pass plain names (e.g."Order Data"); Mechanic quotes them for A1 notation as needed.sheet_rangeis an A1-notation range (e.g."Orders!A2:C10"). A range without a sheet qualifier (e.g."A2:C10") combines withsheet_namewhen one is given. A qualified range that conflicts withsheet_nameis rejected as an error.
Writing values
Operations that write data (create_spreadsheet, append_rows, update_rows, add_sheet) accept "value_input_option":
"raw"(default) β values are stored exactly as given"user_entered"β values are parsed as if typed into the Sheets UI: dates become dates, numbers become numbers, and strings starting with=become formulas
Only use "user_entered" with data you trust. Under user_entered, any cell value beginning with = executes as a live formula in the spreadsheet. Customer-supplied values (order notes, names, line item properties) should be written with the default "raw" mode.
Retries
Reads and idempotent writes (
get_values,update_rows,clear_values,rename_sheet) are retried automatically on transient errors.Ambiguous writes (
append_rows,create_spreadsheet,add_sheet,delete_rows,delete_sheet) are not retried automatically, because a timeout may occur after Google already applied the change β retrying could duplicate rows or delete the wrong ones.append_rowssupports opting in via"retry_on_transient_errors": true.Rate limits (HTTP 429) are always retried automatically, for every operation: Google rejects rate-limited requests before applying anything, so they're safe.
create_spreadsheet
Creates a new spreadsheet β with a single sheet (optionally populated via rows), or with multiple named sheets via sheets.
title
no
Defaults to "New Spreadsheet"
rows
no
Array of arrays; initial data for the default sheet. Mutually exclusive with sheets
sheets
no
Array of {"name": ..., "rows": [...]} objects, to create multiple named sheets
With multiple sheets:
Response:
(folder_path is null when not given; sheets is present when created with sheets.)
append_rows
Adds new rows after a sheet's existing data.
rows
yes
Array of arrays
sheet_range
no
An explicit A1 range to append within
Building rows dynamically:
Response:
update_rows
Writes rows at a specific range, overwriting whatever is there.
rows
yes
Array of arrays
sheet_range
one of these two
e.g. "Orders!A5:C5"
sheet_name
one of these two
Alone, writes starting at the sheet's A1
Response:
clear_values
Clears the values in a range; formatting is left intact.
sheet_range
one of these two
The range to clear
sheet_name
one of these two
Alone, clears the entire sheet
Response:
get_values
Reads values from a range into the action's result. Results are capped at 20MB; narrow the range for very large sheets.
sheet_range
no
Defaults to the entire first sheet when neither this nor sheet_name is given
sheet_name
no
Alone, reads the entire named sheet
value_render_option
no
"formatted_value" (default), "unformatted_value" (raw numbers), or "formula" (cell formulas)
Pair it with a mechanic/actions/perform subscription to use the values in a task β for example, finding which row holds a particular order before updating or deleting it:
Response:
delete_rows
Deletes a span of rows entirely β rows below shift up. Row numbers are 1-based and inclusive, matching what you see in the Sheets UI.
This operation is destructive, and is never retried automatically β see Retries. sheet_name is always required, so a reordering of tabs can never redirect a deletion to the wrong sheet.
sheet_name
yes
start_row
yes
1-based
end_row
no
Defaults to start_row (deletes a single row)
Response:
add_sheet
Adds a new sheet (tab) to an existing spreadsheet, optionally populated with initial rows.
sheet_name
yes
Must not already exist
rows
no
Initial data for the new sheet
Response:
(updated_rows/updated_columns are present when rows were written.)
rename_sheet
Renames a sheet (tab), located by its current name.
sheet_name
yes
The current name
new_sheet_name
yes
Must not already exist
Response:
delete_sheet
Deletes a sheet (tab) by name. A spreadsheet's last remaining sheet cannot be deleted. Like delete_rows, this is never retried automatically β see Retries.
sheet_name
yes
Response:
export_spreadsheet
Exports a spreadsheet. The exported file arrives base64-encoded in the action result.
file_type
no
"xlsx" (default), "csv", "pdf", "html", "ods", "tsv"
Response:
Authentication
This action requires connecting a Google account with the appropriate permissions. To connect an account:
Go to Settings β Authentication
Select Google in the provider list
Follow the Google account connection flow
Folders
When creating spreadsheets, use folder_path to organize your files:
Use forward slashes to separate folder names (e.g.,
"reports/2026/monthly")Folders will be created if they don't exist
Mechanic can only access folders created by this integration
Invalid characters not allowed:
< > : " / \ | ? *
Last updated
Was this helpful?