Format a Google spreadsheet
google_sheets_formatFormat Google Sheets cells, rows, columns, and tabs using ordered batch operations that apply all-or-none and never change cell values.
Instructions
Format a Google spreadsheet's cells, rows, columns and tabs, by spreadsheet (its id or URL): 1 to 100 operations that apply in order as one batch, so all of them land or none does. It never changes a cell's value and never removes anything; applying the same operations again leaves the same result. Each operation is an object with op and its arguments, and the ranges of an operation are A1 notation in range or ranges (a block, whole rows 3:5, whole columns B:D, or a tab's name for all of it). format sets only the properties given on cells (bold, italic, underline, strikethrough, font, font_size, color, background as #rrggbb or null to clear, horizontal_align, vertical_align, wrap, number_format as { type, pattern }, rotation, padding), and reset: true clears every format first. borders draws sides (top, bottom, left, right, inner_horizontal, inner_vertical, all, outer, inner, or none to remove them) with a style and color. size sets the pixels of whole rows or columns, or fits them to their contents with auto: true; hide and unhide act on whole rows or columns; group (optionally collapsed) and ungroup do the same for outline groups, where a span that already is a group is not grouped again and a span that is not a group cannot be ungrouped; unmerge splits merged cells. freeze sets how many rows and columns of a tab stay in view; tab sets a tab's color, hidden, position (from 0) and gridlines, never its title. Any other operation is refused. Read the current formatting with google_sheets_read method format. A call names at most 500 ranges in all. It is asked about every time. account is needed when several accounts are set up.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"spreadsheet": "<spreadsheet>",
"operations": "<operations>"
},
"name": "google_sheets_format"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | No | The account's label. Left out, the only account is used; with several accounts, the call fails and lists them. | |
| operations | Yes | 1 to 100 operations, each an object with an `op` (format, borders, size, hide, unhide, group, ungroup, unmerge, freeze, tab) and that operation's arguments; they apply in order, and all of them land or none does. | |
| spreadsheet | Yes | The spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabs | Yes | The titles of the tabs that were changed, left to right. | |
| applied | Yes | One line per operation, in order, with its ranges as Google resolves them: what was applied. | |
| requests | Yes | How many requests the operations made up in the one batch. | |
| spreadsheet_id | Yes |