Manage protected ranges
manage_protected_rangesAdd, update, or delete protected ranges in Google Sheets to control who can edit specific cells.
Instructions
Manages protections that stop other editors from changing cells. action=add protects a grid range (or a named range via named_range_id; a range with only sheet_id protects the whole sheet): warning_only=true merely warns before edits, otherwise only the listed editor_users/editor_groups (emails) plus the owner may edit — note the calling user is NOT added automatically. Returns the new protectedRangeId in the replies. action=update changes description/warning_only/editors of an existing protection (protected_range_id required; provided fields replace the old values). action=delete removes the protection — the cells and data stay, but anyone with edit access can change them again. Find existing protectedRangeIds via get_spreadsheet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| range | No | add: the cells to protect. | |
| action | Yes | What to do with the protections. | |
| description | No | Label shown in the Sheets UI protections list. | |
| editor_users | No | Emails of users allowed to edit the protected cells. | |
| warning_only | No | true = anyone can still edit after a warning; false = only the listed editors. | |
| editor_groups | No | Emails of Google Groups allowed to edit. | |
| named_range_id | No | add: protect a named range instead of a grid range. | |
| spreadsheet_id | Yes | The spreadsheet id — the long id from the URL (docs.google.com/spreadsheets/d/<spreadsheetId>/edit) or from create_spreadsheet / search_spreadsheets output. | |
| protected_range_id | No | update/delete: the protection's id from get_spreadsheet or the add reply. |