add_data_validation
Configure data validation rules on Google Sheets ranges to enforce dropdowns, checkboxes, dates, numbers, or text constraints, with optional input messages and strict rejection of invalid entries.
Instructions
Set a data validation rule on a cell range — dropdown lists, checkboxes, or date/number/text constraints.
Args:
spreadsheet_id: The ID of the spreadsheet
sheet: The name of the sheet
range: A1 notation range to validate (e.g. "A2:A100")
condition_type: One of the Sheets API's condition types:
"ONE_OF_LIST" — dropdown of custom values (values = the list items)
"ONE_OF_RANGE" — dropdown sourced from another range (values = one item, the
source range in A1 notation, e.g. ["Sheet2!A:A"] — a leading "=" is added
automatically if you omit it)
"BOOLEAN" — checkbox (omit values for a plain TRUE/FALSE checkbox, or give
two values for custom checked/unchecked labels)
"NUMBER_GREATER", "NUMBER_GREATER_THAN_EQ", "NUMBER_LESS",
"NUMBER_LESS_THAN_EQ", "NUMBER_EQ", "NUMBER_NOT_EQ" — one numeric value
"NUMBER_BETWEEN", "NUMBER_NOT_BETWEEN" — two numeric values
"DATE_EQ", "DATE_BEFORE", "DATE_AFTER", "DATE_ON_OR_BEFORE",
"DATE_ON_OR_AFTER" — one date value, e.g. "2025-01-01"
"DATE_BETWEEN", "DATE_NOT_BETWEEN" — two date values
"DATE_IS_VALID" — no values; any parseable date passes
"TEXT_CONTAINS", "TEXT_NOT_CONTAINS", "TEXT_EQ" — one text value
"TEXT_IS_EMAIL", "TEXT_IS_URL" — no values
"CUSTOM_FORMULA" — one formula string, e.g. "=A1>0"
values: Condition values as plain strings — see condition_type above for
how many each type expects. Numbers and dates are passed as
strings; the Sheets API parses them per the cell's format.
input_message: Optional help text shown when a user selects a cell in range.
strict: If True (default), reject input that fails the rule. If False,
show a warning but still allow it.
show_custom_ui: If True (default), show the built-in dropdown/checkbox UI
for condition types that support one (ONE_OF_LIST, ONE_OF_RANGE,
BOOLEAN). Ignored by condition types with no UI (e.g. NUMBER_*,
TEXT_*).
Returns:
Result of the batchUpdate operation.
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": {
"spreadsheet_id": "<spreadsheet_id>",
"sheet": "<sheet>",
"range": "<range>",
"condition_type": "<condition_type>"
},
"name": "add_data_validation"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| range | Yes | ||
| sheet | Yes | ||
| strict | No | ||
| values | No | ||
| input_message | No | ||
| condition_type | Yes | ||
| show_custom_ui | No | ||
| spreadsheet_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||