write_sheet

Write a 2D block of values to a range; every cell is parsed as if typed (USER_ENTERED).

destructiveGoogle Sheets, Docs & Drive

Use it for any block whose cells differ — mixed values and formulas, or a full table. To fill ONE formula down a bounded range (relative references shift per row), write_sheet_formula does it in one call.

Call it

In an AI client (MCP)

tools/call
{
  "name": "write_sheet",
  "arguments": {
    "spreadsheet_id": "<spreadsheet_id>",
    "range_": "<range_>",
    "values": []
  }
}

From code (Tool API)

curl -X POST https://api.sellersheetai.com/api/v1/tools/write_sheet \
  -H "Authorization: Bearer $SELLERSHEET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"spreadsheet_id":"<spreadsheet_id>","range_":"<range_>","values":[]}'
Early access — the Tool API is open on request, contact us.

Arguments

NameTypeDescription
spreadsheet_idrequiredstringthe spreadsheet ID (from its URL or get_sheet_metadata).
range_requiredstringA1 target. The top-left cell ('Sheet1!A1') is enough — the block expands right and down; a multi-cell range must be at least as large as `values`.
valuesrequiredobject[]2D list, one inner list per row. Cells can be strings (incl. "=formulas", date strings, number strings), numbers, booleans, or null for blank. A dropdown cell is not checked against its list — write one of the options get_sheet_cell's dropdown.values lists, verbatim.

Result

Every tool answers {notification, data, human_action}; data carries:

  • written — the number of rows written (top level, not under data).

Gotchas

  • How Sheets parses a string cell (USER_ENTERED):
  • "=SUM(B:B)" → a live formula
  • "2026-05-12" → date serial (sortable, DATEVALUE-able)
  • "2026-05-12 14:30:00" → datetime serial
  • "1234.56" → number 1234.56
  • "15%" → 0.15 with percent display
  • "Plain text" → string (unchanged)
  • "'=literal text" → literal string (apostrophe escapes the leading =)
  • "'07023" → string "07023" with the leading zero kept The spreadsheet must be shared with SellerSheet's Google service account as Editor (workbooks set up by the SellerSheet sidebar already are); a permission error means the user has to share it.

Example

# Mixed values + formula in one call:
write_sheet("1ABC", "Sheet1!A1:B3", [
    ["Month", "Sales"],
    ["Jan", 1000],
    ["Total", "=SUM(B2:B2)"]
])
# Bulk-write 76 IMAGE formulas in one call: pass a 76×1 `values` list
# (one formula string per row) to 'Sheet1!A2:A77'.
# Force a literal "=SUM" as text:
write_sheet("1ABC", "Sheet1!A1", [["'=SUM(B:B)"]])

On this page

Actions

View as Markdown

Ask an assistant

Ask ChatGPTAsk Claude