protect_sheet_range
Protect a range from editing.
writeGoogle Sheets, Docs & Drive
Call it
In an AI client (MCP)
{
"name": "protect_sheet_range",
"arguments": {
"spreadsheet_id": "<spreadsheet_id>",
"range_": "<range_>"
}
}From code (Tool API)
curl -X POST https://api.sellersheetai.com/api/v1/tools/protect_sheet_range \
-H "Authorization: Bearer $SELLERSHEET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"spreadsheet_id":"<spreadsheet_id>","range_":"<range_>"}'Early access — the Tool API is open on request, contact us.
Arguments
| Name | Type | Description |
|---|---|---|
spreadsheet_idrequired | string | the spreadsheet ID (from its URL or get_sheet_metadata). |
range_required | string | A1 range with sheet name, e.g. 'KPIs!A1:E20'. |
description | string | Label shown when a non-editor tries to edit.Default: "" |
warning_only | boolean | If True, show a warning but don't block.Default: false |
editors | object[] | email addresses allowed to edit. Hard lock only: Google does not support editors when warning_only is true. |
Result
Every tool answers {notification, data, human_action}; data carries:
- { protectedRangeId: int, sheetId: int }
Gotchas
- warning_only=False (default): hard-lock. Only editors can modify. warning_only=True: shows a warning dialog, but anyone can proceed. Every range here must name its tab; an open end is allowed ('Tab!C7:C' runs to the bottom, 'Tab!A:D' is whole columns); a range without a tab ('A1:D10') is refused. If editors is not provided, only the spreadsheet owner can edit the protected range.
Example
protect_sheet_range(
"1ABC...", "KPIs!A1:E20",
description="KPI targets - do not edit",
editors=["[email protected]"],
)