ExcelScript.WorksheetProtectionOptions interface

Represents the options in sheet protection.

Remarks

Examples

/**
 * This script protects cells from being selected on the current worksheet.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the protection settings for the current worksheet.
  const currentSheet = workbook.getActiveWorksheet();
  const sheetProtection = currentSheet.getProtection();

  // Create a new WorksheetProtectionOptions object with the selectionMode property set to `none`.
  let protectionOptions : ExcelScript.WorksheetProtectionOptions = {
    selectionMode: ExcelScript.ProtectionSelectionMode.none
  }

  // Apply the given protection options.
  sheetProtection.protect(protectionOptions);
}

Properties

allowAutoFilter

Represents the worksheet protection option allowing use of the AutoFilter feature.

allowDeleteColumns

Represents the worksheet protection option allowing deleting of columns.

allowDeleteRows

Represents the worksheet protection option allowing deleting of rows.

allowEditObjects

Represents the worksheet protection option allowing editing of objects.

allowEditScenarios

Represents the worksheet protection option allowing editing of scenarios.

allowFormatCells

Represents the worksheet protection option allowing formatting of cells.

allowFormatColumns

Represents the worksheet protection option allowing formatting of columns.

allowFormatRows

Represents the worksheet protection option allowing formatting of rows.

allowInsertColumns

Represents the worksheet protection option allowing inserting of columns.

allowInsertHyperlinks

Represents the worksheet protection option allowing inserting of hyperlinks.

allowInsertRows

Represents the worksheet protection option allowing inserting of rows.

allowPivotTables

Represents the worksheet protection option allowing use of the PivotTable feature.

allowSort

Represents the worksheet protection option allowing use of the sort feature.

selectionMode

Represents the worksheet protection option of selection mode.

Property Details

allowAutoFilter

Represents the worksheet protection option allowing use of the AutoFilter feature.

allowAutoFilter?: boolean;

Property Value

boolean

allowDeleteColumns

Represents the worksheet protection option allowing deleting of columns.

allowDeleteColumns?: boolean;

Property Value

boolean

allowDeleteRows

Represents the worksheet protection option allowing deleting of rows.

allowDeleteRows?: boolean;

Property Value

boolean

allowEditObjects

Represents the worksheet protection option allowing editing of objects.

allowEditObjects?: boolean;

Property Value

boolean

allowEditScenarios

Represents the worksheet protection option allowing editing of scenarios.

allowEditScenarios?: boolean;

Property Value

boolean

allowFormatCells

Represents the worksheet protection option allowing formatting of cells.

allowFormatCells?: boolean;

Property Value

boolean

allowFormatColumns

Represents the worksheet protection option allowing formatting of columns.

allowFormatColumns?: boolean;

Property Value

boolean

allowFormatRows

Represents the worksheet protection option allowing formatting of rows.

allowFormatRows?: boolean;

Property Value

boolean

allowInsertColumns

Represents the worksheet protection option allowing inserting of columns.

allowInsertColumns?: boolean;

Property Value

boolean

Represents the worksheet protection option allowing inserting of hyperlinks.

allowInsertHyperlinks?: boolean;

Property Value

boolean

allowInsertRows

Represents the worksheet protection option allowing inserting of rows.

allowInsertRows?: boolean;

Property Value

boolean

allowPivotTables

Represents the worksheet protection option allowing use of the PivotTable feature.

allowPivotTables?: boolean;

Property Value

boolean

allowSort

Represents the worksheet protection option allowing use of the sort feature.

allowSort?: boolean;

Property Value

boolean

selectionMode

Represents the worksheet protection option of selection mode.

selectionMode?: ProtectionSelectionMode;

Property Value