Class PageProtection
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
페이지보호
지원 중단되었습니다. 최신 버전의 Google Sheets에서 만든 스프레드시트의 경우 더 강력한 Protection
클래스를 대신 사용하세요. 이 클래스는 지원 중단되었지만 이전 버전의 Sheets와의 호환성을 위해 계속 사용할 수 있습니다.
이전 버전의 Google Sheets에서 보호된 시트에 액세스하고 수정합니다.
지원 중단된 메서드
addUser(email)
지원 중단되었습니다. 이 함수는 지원 중단되었으므로 새 스크립트에서 사용해서는 안 됩니다.
시트가 보호된 경우 시트를 수정할 수 있는 사용자 목록에 사용자를 추가합니다.
// Add the "user@example.com" user to the list of users who can edit this sheet
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
permissions.addUser('user@example.com');
permissions.setProtected(true);
sheet.setSheetProtection(permissions);
매개변수
이름 | 유형 | 설명 |
email | String | 추가할 사용자의 이메일입니다. |
참고 항목
getUsers()
지원 중단되었습니다. 이 함수는 지원 중단되었으므로 새 스크립트에서 사용해서는 안 됩니다.
이 시트를 수정할 수 있는 사용자의 이메일 주소 목록을 반환합니다.
시트 보호가 사용 중지된 경우 이 호출에서 반환된 값은 의미가 없습니다.
리턴
String[]
- 이 시트를 수정할 수 있는 사용자의 이메일 주소 배열입니다.
isProtected()
지원 중단되었습니다. 이 함수는 지원 중단되었으므로 새 스크립트에서 사용해서는 안 됩니다.
시트에 시트 보호가 사용 설정되어 있는지 여부를 나타냅니다.
// Determine whether or not sheet protection is enabled
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
const isProtected = permissions.isProtected();
리턴
Boolean
- 시트에 시트 보호가 사용 설정되어 있는지 여부입니다.
참고 항목
removeUser(user)
지원 중단되었습니다. 이 함수는 지원 중단되었으므로 새 스크립트에서 사용해서는 안 됩니다.
시트를 수정할 수 있는 사용자 목록에서 사용자를 삭제합니다.
// Remove the "user@example.com" user to the list of users who can edit this
// sheet
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
permissions.removeUser('user@example.com');
permissions.setProtected(true);
sheet.setSheetProtection(permissions);
매개변수
이름 | 유형 | 설명 |
user | String | 삭제할 사용자의 이메일 주소입니다. |
참고 항목
setProtected(protection)
지원 중단되었습니다. 이 함수는 지원 중단되었으므로 새 스크립트에서 사용해서는 안 됩니다.
시트의 보호 상태를 설정합니다.
// Enables sheet protection for this sheet
const sheet = SpreadsheetApp.getActiveSheet();
const permissions = sheet.getSheetProtection();
permissions.setProtected(true);
sheet.setSheetProtection(permissions);
매개변수
이름 | 유형 | 설명 |
protection | Boolean | true : 시트 보호를 사용 설정합니다. false : 시트 보호를 사용 중지합니다. |
참고 항목
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-13(UTC)
[null,null,["최종 업데이트: 2025-08-13(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003ePageProtection\u003c/code\u003e class is deprecated and should not be used in new scripts for spreadsheets created in the newer version of Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003eProtection\u003c/code\u003e class instead for newer Google Sheets for more powerful sheet protection features.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePageProtection\u003c/code\u003e provides methods to manage access and modifications to protected sheets in the older version of Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eDespite being deprecated, \u003ccode\u003ePageProtection\u003c/code\u003e remains available for compatibility with older Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eKey methods include adding/removing users with edit access, checking protection status, and setting protection status.\u003c/p\u003e\n"]]],[],null,["# Class PageProtection\n\nPageProtection\n\n\n**Deprecated.** For spreadsheets created in the newer version of Google Sheets, use the more powerful\n[Protection](/apps-script/reference/spreadsheet/protection) class instead. Although this class is deprecated, it remains available\nfor compatibility with the older version of Sheets.\n\nAccess and modify protected sheets in the older version of Google Sheets. \n\n### Deprecated methods\n\n| Method | Return type | Brief description |\n|----------------------------------------------------|-------------|------------------------------------------------------------------------------|\n| [addUser(email)](#addUser(String)) | `void` | Adds a user to the list of users who can edit the sheet, if it is protected. |\n| [getUsers()](#getUsers()) | `String[]` | Returns a list of the email addresses of the users who can edit this sheet. |\n| [isProtected()](#isProtected()) | `Boolean` | Indicates whether the sheet has sheet protection enabled or not. |\n| [removeUser(user)](#removeUser(String)) | `void` | Removes a user from the list of users who can edit the sheet. |\n| [setProtected(protection)](#setProtected(Boolean)) | `void` | Sets the protection status for the sheet. |\n\nDeprecated methods\n------------------\n\n### `add``User(email)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nAdds a user to the list of users who can edit the sheet, if it is protected.\n\n```javascript\n// Add the \"user@example.com\" user to the list of users who can edit this sheet\nconst sheet = SpreadsheetApp.getActiveSheet();\nconst permissions = sheet.getSheetProtection();\npermissions.addUser('user@example.com');\npermissions.setProtected(true);\nsheet.setSheetProtection(permissions);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|---------|----------|-------------------------------|\n| `email` | `String` | The email of the user to add. |\n\n#### See also\n\n- [removeUser(user)](#removeUser(String))\n\n*** ** * ** ***\n\n### `get``Users()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nReturns a list of the email addresses of the users who can edit this sheet.\n\nIf sheet protection is disabled, the value returned by this call is meaningless.\n\n#### Return\n\n\n`String[]` --- An array of email addresses of users who can edit this sheet.\n\n*** ** * ** ***\n\n### `is``Protected()`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nIndicates whether the sheet has sheet protection enabled or not.\n\n```javascript\n// Determine whether or not sheet protection is enabled\nconst sheet = SpreadsheetApp.getActiveSheet();\nconst permissions = sheet.getSheetProtection();\nconst isProtected = permissions.isProtected();\n```\n\n#### Return\n\n\n`Boolean` --- Whether the sheet has sheet protection enabled or not.\n\n#### See also\n\n- [setProtected(protection)](#setProtected(Boolean))\n\n*** ** * ** ***\n\n### `remove``User(user)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nRemoves a user from the list of users who can edit the sheet.\n\n```javascript\n// Remove the \"user@example.com\" user to the list of users who can edit this\n// sheet\nconst sheet = SpreadsheetApp.getActiveSheet();\nconst permissions = sheet.getSheetProtection();\npermissions.removeUser('user@example.com');\npermissions.setProtected(true);\nsheet.setSheetProtection(permissions);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|----------|------------------------------------------|\n| `user` | `String` | The email address of the user to remove. |\n\n#### See also\n\n- [addUser(email)](#addUser(String))\n\n*** ** * ** ***\n\n### `set``Protected(protection)`\n\n\n**Deprecated.** This function is deprecated and should not be used in new scripts.\n\nSets the protection status for the sheet.\n\n```javascript\n// Enables sheet protection for this sheet\nconst sheet = SpreadsheetApp.getActiveSheet();\nconst permissions = sheet.getSheetProtection();\npermissions.setProtected(true);\nsheet.setSheetProtection(permissions);\n```\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|-----------|-------------------------------------------------------------------------|\n| `protection` | `Boolean` | `true` to enable sheet protection, `false` to disable sheet protection. |\n\n#### See also\n\n- [isProtected()](#isProtected())"]]