sheets_get_formatting_compact
Retrieve cell formatting for a Google Sheets range as compact A1Range→format pairs, collapsing adjacent cells with identical formatting into rectangular ranges to reduce output by over 90% compared to per-cell formatting.
Instructions
Returns cell formatting for a range as compact A1Range→format pairs. Adjacent cells with identical formatting are collapsed into rectangular ranges (run-length encoded). Reduces output by 90%+ compared to per-cell formatting for typical sheets. Use instead of sheets_get_full_sheet_snapshot when you only need formatting data. Supported fields: backgroundColor, backgroundColorStyle, textFormat, horizontalAlignment, verticalAlignment, wrapStrategy, textRotation, numberFormat, padding, borders.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| range | Yes | Range WITHOUT sheet prefix, e.g. "A1:Z85" | |
| fields | No | Optional list of format fields to include, e.g. ["backgroundColor", "textFormat", "borders"]. All supported fields returned if omitted. | |
| sheetName | Yes | Name of the sheet (tab) | |
| spreadsheetId | Yes | The ID of the spreadsheet (found in the URL after /d/) | |
| useEffectiveFormat | No | Use effectiveFormat (true, includes all inherited defaults) or userEnteredFormat (false, default — only explicit overrides). userEnteredFormat produces much smaller output. |