Skip to main content
Glama

sheets.spreadsheets.values.batchUpdate

Set values across multiple ranges of a Google Sheet in one request, choosing RAW or USER_ENTERED input and optional response rendering. Use it to write or update several ranges at once.

Instructions

Sets values in one or more ranges of a spreadsheet. The caller must specify the spreadsheet ID, a valueInputOption, and one or more ValueRanges [HTTP POST] — creates or triggers a change; refused under --readonly safety profiles. Returns the API's response resource as JSON — request body is a JSON BatchUpdateValuesRequest object accepting data, includeValuesInResponse, responseDateTimeRenderOption, responseValueRenderOption, valueInputOption; pass it via params or whole via body_file Siblings over the same resource: append, batchClear, batchClearByDataFilter, batchGet, batchGetByDataFilter, batchUpdateByDataFilter, clear, get, update.

Input Schema

NameRequiredDescriptionDefault
queryNoExtra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe.
paramsNoParameter map merged into the request; typed parameters win.
dry_runNoReturn the request that would be sent, without sending it.
body_fileNoRead the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON BatchUpdateValuesRequest object.
request_bodyNoRequest body of type BatchUpdateValuesRequest: pass it via `params` (merged into the built body) or whole via `body_file`.
spreadsheetIdYes[URL path segment] The ID of the spreadsheet to update.

Output Schema

NameRequiredDescriptionDefault
responsesNo
spreadsheetIdNo
totalUpdatedRowsNo
totalUpdatedCellsNo
totalUpdatedSheetsNo
totalUpdatedColumnsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / body_file / description
      Previous value: -"Read the request body from this file ('-' for stdin) instead of building one from the parameters."New value: +"Read the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON BatchUpdateValuesRequest object."
    • addedInput schema / properties / request_body
      Added value: +{
      +  "description": "Request body of type BatchUpdateValuesRequest: pass it via `params` (merged into the built body) or whole via `body_file`.",
      +  "properties": {
      +    "data": {
      +      "items": {
      +        "properties": {
      +          "majorDimension": {
      +            "enum": [
      +              "DIMENSION_UNSPECIFIED",
      +              "ROWS",
      +              "COLUMNS"
      +            ],
      +            "type": "string"
      +          },
      +          "range": {
      +            "type": "string"
      +          },
      +          "values": {
      +            "items": {
      +              "items": {
      +                "type": "any"
      +              },
      +              "type": "array"
      +            },
      +            "type": "array"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "includeValuesInResponse": {
      +      "type": "boolean"
      +    },
      +    "responseDateTimeRenderOption": {
      +      "enum": [
      +        "SERIAL_NUMBER",
      +        "FORMATTED_STRING"
      +      ],
      +      "type": "string"
      +    },
      +    "responseValueRenderOption": {
      +      "enum": [
      +        "FORMATTED_VALUE",
      +        "UNFORMATTED_VALUE",
      +        "FORMULA"
      +      ],
      +      "type": "string"
      +    },
      +    "valueInputOption": {
      +      "enum": [
      +        "INPUT_VALUE_OPTION_UNSPECIFIED",
      +        "RAW",
      +        "USER_ENTERED"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / spreadsheetId / description
      Previous value: -"The ID of the spreadsheet to update."New value: +"[URL path segment] The ID of the spreadsheet to update."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "responses": {
      +      "items": {
      +        "properties": {
      +          "spreadsheetId": {
      +            "type": "string"
      +          },
      +          "updatedCells": {
      +            "type": "integer"
      +          },
      +          "updatedColumns": {
      +            "type": "integer"
      +          },
      +          "updatedData": {
      +            "properties": {
      +              "majorDimension": {
      +                "enum": [
      +                  "DIMENSION_UNSPECIFIED",
      +                  "ROWS",
      +                  "COLUMNS"
      +                ],
      +                "type": "string"
      +              },
      +              "range": {
      +                "type": "string"
      +              },
      +              "values": {
      +                "items": {
      +                  "items": {
      +                    "type": "any"
      +                  },
      +                  "type": "array"
      +                },
      +                "type": "array"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "updatedRange": {
      +            "type": "string"
      +          },
      +          "updatedRows": {
      +            "type": "integer"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "spreadsheetId": {
      +      "type": "string"
      +    },
      +    "totalUpdatedCells": {
      +      "type": "integer"
      +    },
      +    "totalUpdatedColumns": {
      +      "type": "integer"
      +    },
      +    "totalUpdatedRows": {
      +      "type": "integer"
      +    },
      +    "totalUpdatedSheets": {
      +      "type": "integer"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so well: it declares the HTTP method (POST), that the call creates or triggers a change, and that it is refused under --readonly safety profiles, which is a meaningful precondition most definitions omit. It also names the response shape ('the API's response resource as JSON'), though it omits required OAuth scopes and any batch-size limits or note that empty values clear cells.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with purpose and then the constraints and mutation semantics, so the agent's critical decisions are answered first. The middle sentence is a dense run-on packing body fields and transport options, and the trailing sibling enumeration adds length without guidance, but neither is severely wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-parameter nested-body write tool with an output schema (so return values need no explanation) and no annotations, the description covers mutation semantics, safety-profile refusal, body type, and the two delivery routes. It stops short of auth/scope requirements and any note about limits on number of ranges or cells, which are the residual gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline would be 3, but the description adds genuine meaning beyond the schema: it states valueInputOption is mandatory, whereas the schema's required list contains only spreadsheetId, and it clarifies the relationship between the ValueRanges concept and the body's `data` field plus the `params` vs `body_file` routing. The remaining field list (includeValuesInResponse, render options) merely restates schema properties.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource with scope ('Sets values in one or more ranges of a spreadsheet'), which is precise and clearly a bulk write, distinct from the singular `update` sibling by name alone. However, the sibling list at the end is a bare enumeration that doesn't explain what distinguishes this tool from `append` or `update`, so the differentiation is present but not earned.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through prerequisites ('caller must specify the spreadsheet ID, a valueInputOption, and one or more ValueRanges') and tells the agent the tool is refused under --readonly profiles, which is a useful gate. But it never states when to choose this over `values.update` (single range) or `values.append` (append rows), leaving the agent to infer that the batch variant is for multiple disjoint ranges.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools