Tool: update_spreadsheet
Applies one or more updates to the spreadsheet.
Corresponds to spreadsheets.batchUpdate in the REST API: https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
The list of possible updates is:
updateSpreadsheetProperties: Updates the spreadsheet's properties.updateSheetProperties: Updates a sheet's properties.updateDimensionProperties: Updates dimensions' properties.updateNamedRange: Updates a named range.repeatCell: Repeats a single cell across a range.addNamedRange: Adds a named range.deleteNamedRange: Deletes a named range.addSheet: Adds a sheet.deleteSheet: Deletes a sheet.autoFill: Automatically fills in more data based on existing data.cutPaste: Cuts data from one area and pastes it to another.copyPaste: Copies data from one area and pastes it to another.mergeCells: Merges cells together.unmergeCells: Unmerges merged cells.updateBorders: Updates the borders in a range of cells.updateCells: Updates many cells at once.addFilterView: Adds a filter view.appendCells: Appends cells after the last row with data in a sheet.clearBasicFilter: Clears the basic filter on a sheet.deleteDimension: Deletes rows or columns in a sheet.deleteEmbeddedObject: Deletes an embedded object (e.g, chart, image) in a sheet.deleteFilterView: Deletes a filter view from a sheet.duplicateFilterView: Duplicates a filter view.duplicateSheet: Duplicates a sheet.findReplace: Finds and replaces occurrences of some text with other text.insertDimension: Inserts new rows or columns in a sheet.insertRange: Inserts new cells in a sheet, shifting the existing cells.moveDimension: Moves rows or columns to another location in a sheet.updateEmbeddedObjectPosition: Updates an embedded object's (e.g. chart, image) position.pasteData: Pastes data (HTML or delimited) into a sheet.textToColumns: Converts a column of text into many columns of text.updateFilterView: Updates the properties of a filter view.deleteRange: Deletes a range of cells from a sheet, shifting the remaining cells.appendDimension: Appends dimensions to the end of a sheet.addConditionalFormatRule: Adds a new conditional format rule.updateConditionalFormatRule: Updates an existing conditional format rule.deleteConditionalFormatRule: Deletes an existing conditional format rule.sortRange: Sorts data in a range.setDataValidation: Sets data validation for one or more cells.setBasicFilter: Sets the basic filter on a sheet.addProtectedRange: Adds a protected range.updateProtectedRange: Updates a protected range.deleteProtectedRange: Deletes a protected range.autoResizeDimensions: Automatically resizes one or more dimensions based on the contents of the cells in that dimension.addChart: Adds a chart.updateChartSpec: Updates a chart's specifications.updateBanding: Updates a banded rangeaddBanding: Adds a new banded rangedeleteBanding: Removes a banded rangecreateDeveloperMetadata: Creates new developer metadataupdateDeveloperMetadata: Updates an existing developer metadata entrydeleteDeveloperMetadata: Deletes developer metadatarandomizeRange: Randomizes the order of the rows in a range.addDimensionGroup: Creates a group over the specified range.deleteDimensionGroup: Deletes a group over the specified range.updateDimensionGroup: Updates the state of the specified group.trimWhitespace: Trims cells of whitespace (such as spaces, tabs, or new lines).deleteDuplicates: Removes rows containing duplicate values in specified columns of a cell range.updateEmbeddedObjectBorder: Updates an embedded object's border.addSlicer: Adds a slicer.updateSlicerSpec: Updates a slicer's specifications.addDataSource: Adds a data source.updateDataSource: Updates a data source.deleteDataSource: Deletes a data source.refreshDataSource: Refreshes one or multiple data sources and associated dbobjects.cancelDataSourceRefresh: Cancels refreshes of one or multiple data sources and associated dbobjects.addTable: Adds a table.updateTable: Updates a table.deleteTable: A request for deleting a table.
The following sample demonstrate how to use curl to invoke the update_spreadsheet MCP tool.
| Curl Request |
|---|
curl --location 'https://sheetsmcp.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "update_spreadsheet", "arguments": { // provide these details according to the tool MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
UpdateContentRequest
| JSON representation |
|---|
{ "spreadsheetId": string, "requests": [ { object } ] } |
| Fields | |
|---|---|
spreadsheetId |
Required. The ID of the spreadsheet to update. |
requests[] |
Required. A list of updates to apply to the spreadsheet. Each request should be a valid spreadsheets.batchUpdate Request object, using the schema documented in: https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/request Requests will be applied in the order they are specified. If any request is not valid, no requests will be applied. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ "nullValue": null, "numberValue": number, "stringValue": string, "boolValue": boolean, "structValue": { object }, "listValue": array } |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
Output Schema
Represents a JSON object.
An unordered key-value map, intending to perfectly capture the semantics of a JSON object. This enables parsing any arbitrary JSON payload as a message field in ProtoJSON format.
This follows RFC 8259 guidelines for interoperable JSON: notably this type cannot represent large Int64 values or NaN/Infinity numbers, since the JSON format generally does not support those values in its number type.
If you do not intend to parse arbitrary JSON into your message, a custom typed message should be preferred instead of using this type.
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ "nullValue": null, "numberValue": number, "stringValue": string, "boolValue": boolean, "structValue": { object }, "listValue": array } |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ✅