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

This example shows how to return the sheet number of the reference sheet.

// How to get a sheet number.

// Use a function to get a sheet index.

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