Skip to main content

SHEET

Returns the sheet number of the reference sheet.

Syntax

expression.SHEET(arg1);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1Optionalstring | ApiRange | ApiNameThe name of a sheet or a reference for which the sheet number will be returned. If omitted the number of the sheet containing the function is returned.

Returns

number

Example

Return the sheet number of the reference sheet in a spreadsheet.

// How to get a sheet number in a spreadsheet.

// Use a function to get a sheet index in a spreadsheet.

const worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
let result = func.SHEET("Sheet1");
worksheet.GetRange("C3").SetValue(result);