write_gsheet
Consolidated Google Sheets write tool. Provide spec.mode to choose one operation: replace, append, clear, or batch. Examples: 1) Replace model output in a target range: {“mode”:“replace”,“run_id”:”…”,“output_name”:“forecast.json”,“cell_range”:“Forecast!A1”}. 2) Append model output to a tab: {“mode”:“append”,“run_id”:”…”,“output_name”:“forecast.json”,“sheet_name”:“History”}. 3) Clear an A1 range: {“mode”:“clear”,“cell_range”:“Sheet1!A2:Z”}. 4) Batch-write explicit values to ranges: {“mode”:“batch”,“data”:[{“range”:“Sheet1!A1:B2”,“values”:[[1,2],[3,4]]}]}. Returns: spreadsheet_id (str | null) — target spreadsheet; mode (str | null) — write mode when applicable; rows_written / ranges_written / total_rows (int | null) — write counts; sheet_name / cell_range / cleared_range (str | null) — affected location; sheet_url (str | null) — direct Google Sheets URL; error / message / hint (str | null) — soft-error details when the operation fails.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
project_name | str | Yes | — | |
spec | WriteSpec | Yes | — |
Returns
Section titled “Returns”Returns a structured object. Top-level fields:
spreadsheet_id(string)sheet_name(string)cell_range(string)rows_written(integer)mode(string)sheet_url(string)
See the response example below for the full payload shape.
Example
Section titled “Example”Tool Call
Section titled “Tool Call”{ "name": "write_gsheet", "arguments": { "project_name": "forecasts", "spec": { "tab_name": "Forecast", "cell_range": "A1", "values": [ [ "Month", "Revenue" ], [ "2026-01", 100 ], [ "2026-02", 110 ] ], "value_input_option": "RAW", "spreadsheet_id": "1aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ABCDEFG" } }}Response
Section titled “Response”{ "spreadsheet_id": "1aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ABCDEFG", "sheet_name": "Forecast", "cell_range": "A1:B3", "rows_written": 3, "mode": "replace", "sheet_url": "https://docs.google.com/spreadsheets/d/1aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ABCDEFG/edit"}- Module:
Export to Sheets - Requires authentication via API token or Auth0 JWT.