Format cells
format_cellsApply formatting changes to selected spreadsheet cells: set colors, font styles, alignment, text wrapping, or number formats without altering existing formatting outside the specified properties.
Instructions
Applies cell formatting to a range: background_color, text color/bold/italic/strikethrough/underline/font_size/font_family, horizontal/vertical alignment, wrap_strategy, and number format (number_format_type NUMBER/PERCENT/CURRENCY/DATE/TIME/DATE_TIME/SCIENTIFIC/TEXT with an optional number_format_pattern like "#,##0.00" or "dd.mm.yyyy"). Only the provided properties are touched — the update mask is computed automatically, so existing formatting outside it survives; at least one formatting field is required. The range is a grid rectangle addressed by sheet_id + 0-based indexes (get sheet_id from get_spreadsheet). Colors are "#RRGGBB" hex strings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | Bold text. | |
| range | Yes | Cell rectangle in grid coordinates: rows 1-10 × columns A-B = {start_row_index:0, end_row_index:10, start_column_index:0, end_column_index:2}. | |
| italic | No | Italic text. | |
| font_size | No | Font size in points. | |
| underline | No | Underlined text. | |
| text_color | No | Text color "#RRGGBB". | |
| font_family | No | Font family, e.g. "Roboto". | |
| strikethrough | No | Strikethrough text. | |
| wrap_strategy | No | How long text behaves: overflow into empty neighbors, clip at the edge, or wrap. | |
| spreadsheet_id | Yes | The spreadsheet id — the long id from the URL (docs.google.com/spreadsheets/d/<spreadsheetId>/edit) or from create_spreadsheet / search_spreadsheets output. | |
| background_color | No | Hex color "#RRGGBB", e.g. "#FF0000". | |
| number_format_type | No | Number format category. | |
| vertical_alignment | No | Vertical alignment. | |
| horizontal_alignment | No | Horizontal alignment. | |
| number_format_pattern | No | Format pattern, e.g. "#,##0.00", "0.0%", "dd.mm.yyyy" (requires number_format_type). |