Enum ProtectionType

ProtectionType

스프레드시트에서 편집 가능한 부분을 나타내는 열거형입니다.

enum을 호출하려면 상위 클래스, 이름, 속성을 호출합니다. SpreadsheetApp.ProtectionType.RANGE을 예로 들 수 있습니다.

// Remove all range protections in the spreadsheet that the user has permission to edit.
var ss = SpreadsheetApp.getActive();
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protections.length; i++) {
  var protection = protections[i];
  if (protection.canEdit()) {
    protection.remove();
  }
}
// Removes sheet protection from the active sheet, if the user has permission to edit it.
var sheet = SpreadsheetApp.getActiveSheet();
var protection = sheet.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];
if (protection && protection.canEdit()) {
  protection.remove();
}

속성

속성유형설명
RANGEEnum특정 범위까지 보호
SHEETEnum시트 보호