protect_sheet_range
Restrict editing of a spreadsheet range by setting a protected range. Choose strict blocking or a warning dialog to prevent unauthorized changes to sensitive cells.
Instructions
Protect a range in a spreadsheet so unauthorized users cannot edit it.
Adds a Sheets "Protected range" entry (Data > Protect sheets and ranges) restricting who can modify the cells. Two enforcement modes: strict (non-editors are blocked) or warning-only (a confirmation dialog appears, but edits are allowed). Use strict for financial data, formula cells, or anything where an accidental overwrite would corrupt downstream calcs.
Requires OAuth scope: https://www.googleapis.com/auth/spreadsheets (write).
Protection does NOT prevent the owner or anyone with file-level "Editor"
permission on the Drive file from bypassing via the Sheets UI — it only
gates in-cell edits. For hard access control, use Drive sharing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | Yes | ||
| spreadsheet_id | Yes | Google Sheets spreadsheet ID (from the URL after `/d/`). | |
| range_name | Yes | A1-notation range to protect, e.g., `"Sheet1!A1:D10"`, `"Summary!B:B"` (entire column), `"'My Sheet'!A1:Z100"` (sheet name with spaces). To protect an entire sheet, use `manage_sheet_tabs` or pass the full sheet range (`Sheet1!A1:ZZ1000000`). | |
| description | No | Human-readable note shown in the Protected ranges sidebar (e.g., "Formulas — do not edit"). Omit for no description. | |
| editor_emails | No | List of Google account email addresses allowed to edit this range. Omit (or pass `None`) to restrict edits to the spreadsheet owner only. Editors must already have access to the file at the Drive level; adding emails here does not share the file. | |
| warning_only | No | When `True`, edits are allowed after a "Are you sure?" confirmation dialog (suitable for nudging users). When `False` (default), edits are strictly blocked for non-editors. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |