AddProtectedRange

function AddProtectedRange(sTitle: string = null, sDataRange: string = null): ApiProtectedRange | "null"

Description

Creates a protected range of the specified type from the selected data range of the current sheet.

Parameters

sTitlestringdefault: null

The title which will be displayed for the current protected range.

sDataRangestringdefault: null

The selected cell range which will be used to get the data for the protected range.

Returns

ApiProtectedRange | "null"

Try It

var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange("A1").SetValue("1");
oWorksheet.GetRange("B1").SetValue("2");
oWorksheet.AddProtectedRange("protectedRange", "Sheet1!$A$1:$B$1");

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).