add_sheet_data_validation
Apply data-validation rules (dropdowns, number bounds, custom formulas) to a Google Sheets range. Replaces existing validation to enforce input constraints.
Instructions
Apply a data-validation rule to a range (dropdowns, bounds, formulas).
Side effects: replaces any existing validation on the range. For conditional formatting (color rules) use manage_conditional_formatting. For protecting cells from edits use protect_sheet_range. Requires the spreadsheets OAuth scope.
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>",
"validation_type": "<validation_type>"
},
"name": "add_sheet_data_validation"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | Yes | The user's Google email address (authenticated account). | |
| spreadsheet_id | Yes | Target spreadsheet ID. | |
| range_name | Yes | A1 range, e.g. "Sheet1!A1:A10" or "A1:A10". | |
| validation_type | Yes | ONE_OF_LIST, NUMBER_BETWEEN, NUMBER_GREATER, NUMBER_LESS, NUMBER_EQ, TEXT_CONTAINS, TEXT_EQ, DATE_AFTER, DATE_BEFORE, DATE_ON_OR_AFTER, DATE_ON_OR_BEFORE, CUSTOM_FORMULA, or BOOLEAN. | |
| values | No | For ONE_OF_LIST: allowed dropdown options. For NUMBER_BETWEEN: [min, max]. For single-value conditions: [value]. Ignored for BOOLEAN and CUSTOM_FORMULA. | |
| custom_formula | No | For CUSTOM_FORMULA only — an expression returning TRUE to allow, e.g. "=A1>0" or "=REGEXMATCH(A1,"^\d+$")". | |
| strict | No | True rejects invalid input outright. False shows a warning but accepts the entry. | |
| show_dropdown | No | For ONE_OF_LIST — True (default) renders the dropdown arrow; False hides it while still enforcing the rule. | |
| input_message | No | Optional help text shown when the cell is focused. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |