Enum ProtectionType

ProtectionType

Eine Aufzählung der Teile einer Tabelle, die vor Bearbeitungen geschützt werden können.

Um eine Enumeration aufzurufen, rufen Sie deren übergeordnete Klasse, ihren Namen und ihre Eigenschaft auf. Beispiel: 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();
}

Attribute

AttributTypBeschreibung
RANGEEnumSchutz für einen Bereich.
SHEETEnumSchutz für ein Tabellenblatt.