Skip to main content

GetCells

Returns a Range object that represents all the cells in the specified range or a specified cell.

Syntax

expression.GetCells(row, col);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
rowRequirednumberThe row number or the cell number (if only row is defined).
colRequirednumberThe column number.

Returns

ApiRange

Example

Access a specific cell within a range by its row and column position in a spreadsheet.

// How do I pick out one cell from a larger range in a spreadsheet?

// Target a single cell inside a multi-cell range and fill it with a highlight color.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("A1:C3");
range.GetCells(2, 1).SetFillColor(Api.CreateColorFromRGB(255, 213, 191));