• 這個頁面中的內容
  • 屬性

Enum ProtectionType

  • 這個頁面中的內容
  • 屬性
ProtectionType

此列舉代表可防止編輯的試算表部分。

如要呼叫列舉,請呼叫其父項類別、名稱和屬性。例如 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();
}

屬性

屬性類型說明
RANGEEnum保護範圍。
SHEETEnum保護工作表。