format_cells
Apply formatting to a range of cells in Google Sheets, including bold, italic, font size, text color, background color, and alignment.
Instructions
Apply formatting to a range of cells.
Examples: - Format header row bold with blue background: format_cells("abc", 0, 0, 1, 0, 5, bold=True, background_color="#4285F4") - Center align cells A1:C10: format_cells("abc", 0, 0, 10, 0, 3, alignment="CENTER")
Note: Indices are 0-based. Row 1 in sheets = index 0. Column A = index 0. end_row and end_col are EXCLUSIVE (like Python ranges).
Args: spreadsheet_id: The ID from the spreadsheet URL. sheet_id: Numeric sheet ID (get from list_sheets or get_spreadsheet_info). start_row: Starting row index (0-based, so row 1 = 0). end_row: Ending row index (exclusive, so rows 1-5 = start=0, end=5). start_col: Starting column index (0-based, A=0, B=1, C=2...). end_col: Ending column index (exclusive). bold: Make text bold (True/False). italic: Make text italic (True/False). font_size: Font size in points (0 to skip, typical: 10-14). font_color: Hex color for text (e.g., "#FF0000"=red, "#FFFFFF"=white). background_color: Hex color for cell background (e.g., "#4285F4"=blue). alignment: "LEFT", "CENTER", or "RIGHT".
Returns: Success message.
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_id": "<spreadsheet_id>",
"sheet_id": "<sheet_id>",
"start_row": "<start_row>",
"end_row": "<end_row>",
"start_col": "<start_col>",
"end_col": "<end_col>"
},
"name": "format_cells"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | ||
| italic | No | ||
| end_col | Yes | ||
| end_row | Yes | ||
| sheet_id | Yes | ||
| alignment | No | ||
| font_size | No | ||
| start_col | Yes | ||
| start_row | Yes | ||
| font_color | No | ||
| spreadsheet_id | Yes | ||
| background_color | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |