manage_conditional_formatting
Add, update, or delete conditional formatting rules in Google Sheets to automatically highlight cells based on specified conditions, colors, or gradients.
Instructions
Manages conditional formatting rules on a Google Sheet. Supports adding, updating, and deleting conditional formatting rules via a single tool.
Args: user_google_email (str): The user's Google email address. Required. spreadsheet_id (str): The ID of the spreadsheet. Required. action (str): The operation to perform. Must be one of "add", "update", or "delete". range_name (Optional[str]): A1-style range (optionally with sheet name). Required for "add". Optional for "update" (preserves existing ranges if omitted). Not used for "delete". condition_type (Optional[str]): Sheets condition type (e.g., NUMBER_GREATER, TEXT_CONTAINS, DATE_BEFORE, CUSTOM_FORMULA). Required for "add". Optional for "update" (preserves existing type if omitted). condition_values (Optional[Union[str, List[Union[str, int, float]]]]): Values for the condition; accepts a list or a JSON string representing a list. Depends on condition_type. Used by "add" and "update". background_color (Optional[str]): Hex background color to apply when condition matches. Used by "add" and "update". text_color (Optional[str]): Hex text color to apply when condition matches. Used by "add" and "update". rule_index (Optional[int]): 0-based index of the rule. For "add", optionally specifies insertion position. Required for "update" and "delete". gradient_points (Optional[Union[str, List[dict]]]): List (or JSON list) of gradient points for a color scale. If provided, a gradient rule is created and boolean parameters are ignored. Used by "add" and "update". sheet_name (Optional[str]): Sheet name to locate the rule when range_name is omitted. Defaults to the first sheet. Used by "update" and "delete".
Returns: str: Confirmation of the operation and the current rule state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| range_name | No | ||
| rule_index | No | ||
| sheet_name | No | ||
| text_color | No | ||
| condition_type | No | ||
| spreadsheet_id | Yes | ||
| gradient_points | No | ||
| background_color | No | ||
| condition_values | No | ||
| user_google_email | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |