Add Conditional Formatting Rule
add_conditional_format_ruleAdd a cell-value conditional formatting rule to an Excel range, applying fill, font, or bold styles when conditions like greater than or between are met. Works on live open workbooks.
Instructions
Add a cell-value conditional formatting rule to a range.
Args: workbook: Workbook name or path (None = active workbook). sheet: Worksheet name (None = active sheet). range_address: A1-style address, e.g. "A1:A20". condition: One of "greater_than", "less_than", "greater_equal", "less_equal", "equal_to", "not_equal", "between", "not_between". value1: Comparison value (required). Numbers or text. value2: Second comparison value, required only for "between"/ "not_between". fill_color: Hex RGB cell fill to apply when the rule matches. font_color: Hex RGB font color to apply when the rule matches. bold: Bold the font when the rule matches.
Returns: JSON with the new rule's index (rules apply in index order).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bold | No | ||
| sheet | No | ||
| value1 | No | ||
| value2 | No | ||
| workbook | No | ||
| condition | No | greater_than | |
| fill_color | No | ||
| font_color | No | ||
| range_address | No | A1 |