add_conditional_formatting
Apply conditional formatting rules to Google Sheets ranges to highlight cells based on specific conditions like values, dates, or custom formulas.
Instructions
Adds a conditional formatting rule to a range.
Args: user_google_email (str): The user's Google email address. Required. spreadsheet_id (str): The ID of the spreadsheet. Required. range_name (str): A1-style range (optionally with sheet name). Required. condition_type (str): Sheets condition type (e.g., NUMBER_GREATER, TEXT_CONTAINS, DATE_BEFORE, CUSTOM_FORMULA). 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. background_color (Optional[str]): Hex background color to apply when condition matches. text_color (Optional[str]): Hex text color to apply when condition matches. rule_index (Optional[int]): Optional position to insert the rule (0-based) within the sheet's rules. 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.
Returns: str: Confirmation of the added rule.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"user_google_email": "<user_google_email>",
"spreadsheet_id": "<spreadsheet_id>",
"range_name": "<range_name>",
"condition_type": "<condition_type>"
},
"name": "add_conditional_formatting"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | Yes | ||
| spreadsheet_id | Yes | ||
| range_name | Yes | ||
| condition_type | Yes | ||
| condition_values | No | ||
| background_color | No | ||
| text_color | No | ||
| rule_index | No | ||
| gradient_points | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |