SHEETS
Returns the number of sheets in a reference.
Syntax
expression.SHEETS(arg1);
expression
- A variable that represents a ApiWorksheetFunction class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
arg1 | Optional | ApiRange | ApiName | A 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
- Code
- Result
// 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);