Skip to main content

GetSheet

Returns an object that represents a sheet.

Syntax

expression.GetSheet(nameOrIndex);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
nameOrIndexRequiredstring | numberSheet name or sheet index.

Returns

ApiWorksheet | null

Example

Get an object that represents a sheet in a spreadsheet.

// How to get a sheet knowing its name in a spreadsheet.

// Find and get a sheet object by its name in a spreadsheet.

let worksheet = Api.GetSheet("Sheet1");
worksheet.GetRange("A1").SetValue("This is a sample text on 'Sheet1'.");