Enum ProtectionType
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
보호유형
수정으로부터 보호할 수 있는 스프레드시트의 부분을 나타내는 열거형입니다.
enum을 호출하려면 상위 클래스, 이름, 속성을 호출합니다. 예를 들면
SpreadsheetApp.ProtectionType.RANGE
입니다.
// Remove all range protections in the spreadsheet that the user has permission
// to edit.
const ss = SpreadsheetApp.getActive();
const protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (const protection of protections) {
if (protection.canEdit()) {
protection.remove();
}
}
// Removes sheet protection from the active sheet, if the user has permission to
// edit it.
const sheet = SpreadsheetApp.getActiveSheet();
const protection = sheet.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];
if (protection?.canEdit()) {
protection.remove();
}
속성
속성 | 유형 | 설명 |
RANGE | Enum | 범위 보호 |
SHEET | Enum | 시트 보호 |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003e\u003ccode\u003eProtectionType\u003c/code\u003e is an enum used to specify whether you are working with sheet or range protection in Google Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eIt has two properties: \u003ccode\u003eSHEET\u003c/code\u003e and \u003ccode\u003eRANGE\u003c/code\u003e, that are used with the \u003ccode\u003egetProtections()\u003c/code\u003e method to retrieve the corresponding protections.\u003c/p\u003e\n"],["\u003cp\u003eYou can use \u003ccode\u003eProtectionType\u003c/code\u003e to remove or modify existing protections within your spreadsheet, given the necessary permissions.\u003c/p\u003e\n"]]],[],null,["# Enum ProtectionType\n\nProtectionType\n\nAn enumeration representing the parts of a spreadsheet that can be protected from edits.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nSpreadsheetApp.ProtectionType.RANGE`.\n\n```javascript\n// Remove all range protections in the spreadsheet that the user has permission\n// to edit.\nconst ss = SpreadsheetApp.getActive();\nconst protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);\nfor (const protection of protections) {\n if (protection.canEdit()) {\n protection.remove();\n }\n}\n``` \n\n```javascript\n// Removes sheet protection from the active sheet, if the user has permission to\n// edit it.\nconst sheet = SpreadsheetApp.getActiveSheet();\nconst protection = sheet.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];\nif (protection?.canEdit()) {\n protection.remove();\n}\n``` \n\n### Properties\n\n| Property | Type | Description |\n|----------|--------|-------------------------|\n| `RANGE` | `Enum` | Protection for a range. |\n| `SHEET` | `Enum` | Protection for a sheet. |"]]