sheet_batch_update

Apply several raw Sheets API v4 requests (spreadsheets.batchUpdate) in one call.

destructiveGoogle Sheets, Docs & Drive

Use it for 3+ structural operations at once (write values + format header + autofit columns + freeze panes); a single operation reads better through its dedicated tool (write_sheet, format_sheet_range), because the raw request shape is verbose.

Call it

In an AI client (MCP)

tools/call
{
  "name": "sheet_batch_update",
  "arguments": {
    "spreadsheet_id": "<spreadsheet_id>",
    "requests": []
  }
}

From code (Tool API)

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

Arguments

NameTypeDescription
spreadsheet_idrequiredstringthe spreadsheet ID (from its URL or get_sheet_metadata).
requestsrequiredobject[]a non-empty list of Sheets v4 Request objects, e.g. updateCells, repeatCell, updateBorders, mergeCells, addBanding, autoResizeDimensions, updateSheetProperties, updateDimensionProperties, insertDimension, deleteDimension, addProtectedRange. Ranges are GridRange objects: the integer sheetId (list_sheet_tabs), a 0-based start*Index and an exclusive end*Index. Colours are {red, green, blue} floats 0–1.

Result

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

  • data.replies — one reply per request, in order; requests that return nothing get an empty reply, and addSheet's reply carries the new sheetId.
  • data.requestCount — the number of requests applied.

Gotchas

  • Google applies the requests in order, as one unit: one invalid request fails the whole call and nothing is applied. Request reference: https: //developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate

Example

Bold a header row and autofit two columns in one call.
sheet_batch_update("1ABC...", [
    {"repeatCell": {
        "range": {"sheetId": 0, "startRowIndex": 0, "endRowIndex": 1,
                  "startColumnIndex": 0, "endColumnIndex": 4},
        "cell": {"userEnteredFormat": {"textFormat": {"bold": True}}},
        "fields": "userEnteredFormat.textFormat.bold",
    }},
    {"autoResizeDimensions": {
        "dimensions": {"sheetId": 0, "dimension": "COLUMNS",
                       "startIndex": 0, "endIndex": 4},
    }},
])

On this page

Actions

View as Markdown

Ask an assistant

Ask ChatGPTAsk Claude