Add protected range to the sheet. Only the editors can edit the protected range. Google API will automatically add the owner of this SpreadSheet. The list ``editor_users_emails`` must at least contain the e-mail address used to open that SpreadSheet. ``edito
(
self,
name: str,
editor_users_emails: Sequence[str] = [],
editor_groups_emails: Sequence[str] = [],
description: Optional[str] = None,
warning_only: bool = False,
requesting_user_can_edit: bool = False,
)
| 2042 | |
| 2043 | @cast_to_a1_notation |
| 2044 | def add_protected_range( |
| 2045 | self, |
| 2046 | name: str, |
| 2047 | editor_users_emails: Sequence[str] = [], |
| 2048 | editor_groups_emails: Sequence[str] = [], |
| 2049 | description: Optional[str] = None, |
| 2050 | warning_only: bool = False, |
| 2051 | requesting_user_can_edit: bool = False, |
| 2052 | ) -> JSONResponse: |
| 2053 | """Add protected range to the sheet. Only the editors can edit |
| 2054 | the protected range. |
| 2055 | |
| 2056 | Google API will automatically add the owner of this SpreadSheet. |
| 2057 | The list ``editor_users_emails`` must at least contain the e-mail |
| 2058 | address used to open that SpreadSheet. |
| 2059 | |
| 2060 | ``editor_users_emails`` must only contain e-mail addresses |
| 2061 | who already have a write access to the spreadsheet. |
| 2062 | |
| 2063 | :param str name: A string with range value in A1 notation, |
| 2064 | e.g. 'A1:A5'. |
| 2065 | |
| 2066 | Alternatively, you may specify numeric boundaries. All values |
| 2067 | index from 1 (one): |
| 2068 | |
| 2069 | :param int first_row: First row number |
| 2070 | :param int first_col: First column number |
| 2071 | :param int last_row: Last row number |
| 2072 | :param int last_col: Last column number |
| 2073 | |
| 2074 | For both A1 and numeric notation: |
| 2075 | |
| 2076 | :param list editor_users_emails: The email addresses of |
| 2077 | users with edit access to the protected range. |
| 2078 | This must include your e-mail address at least. |
| 2079 | :param list editor_groups_emails: (optional) The email addresses of |
| 2080 | groups with edit access to the protected range. |
| 2081 | :param str description: (optional) Description for the protected |
| 2082 | ranges. |
| 2083 | :param boolean warning_only: (optional) When true this protected range |
| 2084 | will show a warning when editing. Defaults to ``False``. |
| 2085 | :param boolean requesting_user_can_edit: (optional) True if the user |
| 2086 | who requested this protected range can edit the protected cells. |
| 2087 | Defaults to ``False``. |
| 2088 | """ |
| 2089 | |
| 2090 | grid_range = a1_range_to_grid_range(name, self.id) |
| 2091 | |
| 2092 | body = { |
| 2093 | "requests": [ |
| 2094 | { |
| 2095 | "addProtectedRange": { |
| 2096 | "protectedRange": { |
| 2097 | "range": grid_range, |
| 2098 | "description": description, |
| 2099 | "warningOnly": warning_only, |
| 2100 | "requestingUserCanEdit": requesting_user_can_edit, |
| 2101 | "editors": ( |