formatCells
Applies bold, font size, colors, alignment, and number formats to a bounded Google Sheets range, including clearing date formats by setting type to TEXT.
Instructions
Applies formatting to a range of cells in a spreadsheet. Supports bold, italic, font size, text color, background color, alignment, and number format. Modern runtimes require a bounded readCellFormat handle for the exact overwritten range. Use a bounded range such as 'A1:D1' for header cells. Direct legacy callers retain whole-row and whole-column formatting through the tracker fallback. Use numberFormat to control how values are displayed (e.g. as numbers, text, dates) or to clear a format by setting type to 'TEXT'.
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": {
"spreadsheetId": "<spreadsheetId>",
"range": "<range>"
},
"name": "formatCells"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | Apply bold text formatting. | |
| range | Yes | Bounded A1 range to format, such as "Sheet1!A1:D1" or "B2:E10". Modern calls require a matching readCellFormat handle; unbounded rows/columns remain available only to direct legacy callers. | |
| italic | No | Apply italic text formatting. | |
| fontSize | No | Font size in points. | |
| readHandle | No | Capability returned by the corresponding read tool. Required on the modern MCP runtime, including modern stdio. | |
| numberFormat | No | Controls how cell values are displayed. Useful for clearing date formatting (set type to "TEXT") or applying a custom number pattern. | |
| spreadsheetId | Yes | The spreadsheet ID — the long string between /d/ and /edit in a Google Sheets URL. | |
| backgroundColor | No | Cell background color as hex (e.g., "#D9EAD3"). | |
| foregroundColor | No | Text color as hex (e.g., "#FF0000"). | |
| horizontalAlignment | No | Horizontal text alignment. |