跳到主要内容

SHEETS

Returns the number of sheets in a reference.

Syntax

expression.SHEETS(arg1);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1OptionalApiRange | ApiNameA reference for which the number of sheets will be returned. If omitted the number of sheets in the workbook containing the function is returned.

Returns

number

Example

// Add more sheets
Api.AddSheet("Sheet2")
Api.AddSheet("Sheet3")

// Get the number of sheets
let func = Api.GetWorksheetFunction();
let result = func.SHEETS();
const worksheet = Api.GetActiveSheet();
worksheet.GetRange("C3").SetValue(result);