set_sheet_conditional_formats
Apply conditional formatting rules to a Google Sheets tab so whole rows recolor by formula when status text changes. Replaces prior rules with the same tag, leaving manually added formats untouched.
Instructions
Colour whole rows by rule, as conditional formatting keyed on a formula.
Use this to colour-code a tracker by a status column rather than painting
cells once: the sheet recolours itself whenever the status text changes,
and nobody has to remember to repaint. Each rule in rules is
{"formula": ..., "background": ..., "foreground": ...} where
formula is a Sheets custom formula written for the first data row,
e.g. REGEXMATCH(LOWER($D2), "^applied") (no leading =; $D2
means column D of whichever row is being tested), and background /
foreground are hex colours like "#FFF3A0" (either may be omitted).
Rules are evaluated in order and the first true one paints the row, so
put the most specific (for example "closed" or "rejected") first.
Every rule this tool writes carries tag inside its formula, and a
later call with the same tag deletes those rules before adding the
new set, so the call is idempotent and never touches rules a person
added by hand. Use a distinct tag per scheme if one tab carries two.
Rules apply to every column from first_row (1-based, default 2 to
skip a header) to the bottom of the grid.
sheet_id is the spreadsheet's ID (from its URL) and is required.
tab is the worksheet title (see list_sheet_tabs). Returns a
summary of rules removed and added.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tab | Yes | ||
| tag | No | ai-toolkit | |
| rules | Yes | ||
| sheet_id | Yes | ||
| first_row | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |