Skip to content

ReferenceAPI

Range

Cells: values, formulas, formats, and reading them back.

Range.md

Cells: values, formulas, formats, and reading them back. The same text agents read through help().

A rectangle of cells on a sheet: sheet.range("A1:C3"). Reads give what cells show (a formula’s computed value); writes take a matrix, or one value for every cell.

Option Type Description
address (required) string “A1:C3” (or “B2” for one cell).
fullAddress (required) string “Model!A1:C3”.
rowCount (required) number How many rows the range spans.
columnCount (required) number How many columns the range spans.
bounds (required) Readonly<RangeAddress> Top-left row and column (0-based) and the bottom-right ones.
values (required) Scalar[][] What the cells show, row by row: numbers, text, true/false, errors, or null when empty.
value (required) Scalar The top-left cell’s value.
formulas (required) Scalar[][] Formulas (“=B2*2”) where cells have them, values elsewhere.
formulasR1C1 (required) Scalar[][] Formulas in R1C1 notation (“=R[-1]C*2”), values elsewhere.
formulaR1C1 (required) string | undefined The top-left cell’s formula in R1C1 notation, or undefined.
formula (required) string | undefined The top-left cell’s formula, or undefined.
write() (required) method Writes a matrix or one value (see values).
fillDown() (required) method Copies the top row (values, formulas adjusted per row, formats) into the rows below it.
fillRight() (required) method Copies the left column into the columns to its right.
format() (required) method Applies a look to every cell (merged with what the cells have): range.format({ bold: true, fill: "accent1" }), or range.format = { … }.
look (required) Readonly<CellFormatInput> The top-left cell’s look.
numberFormat (required) string | undefined The top-left cell’s number format.
setBorder() (required) method Draws borders on part of the range: “outside” (around it), “inside” (between cells), “all”, one side, or “insideHorizontal” / “insideVertical”.
clear() (required) method Clears values and formulas, formats, or both (default).
merge() (required) method Merges the range into one cell (the top-left keeps its value).
note (required) string A hover note on the top-left cell.
link (required) string A link on the top-left cell: a URL, or “#Sheet!A1” for a place in the workbook.
cell() (required) method One cell of the range, 0-based from its top-left.
offset() (required) method The same size, moved by rows and columns.
resize() (required) method The same top-left, with a new size.
address: range.address: string

“A1:C3” (or “B2” for one cell).

bounds: range.bounds: Readonly<RangeAddress>

Top-left row and column (0-based) and the bottom-right ones.

range.cell(row: number, column: number): Range

One cell of the range, 0-based from its top-left.

range.clear(what: "all" | "contents" | "formats"?): this

Clears values and formulas, formats, or both (default).

columnCount: range.columnCount: number

How many columns the range spans.

range.fillDown(): this

Copies the top row (values, formulas adjusted per row, formats) into the rows below it.

range.fillRight(): this

Copies the left column into the columns to its right.

range.format(input: CellFormatInput): this

Applies a look to every cell (merged with what the cells have): range.format({ bold: true, fill: "accent1" }), or range.format = { … }.

Options: CellFormatInput.

range.format({ bold: true, fill: "accent1" })
formula: range.formula: string | undefined

The top-left cell’s formula, or undefined.

formulaR1C1: range.formulaR1C1: string | undefined

The top-left cell’s formula in R1C1 notation, or undefined.

formulas: range.formulas: Scalar[][]

Formulas (“=B2*2”) where cells have them, values elsewhere.

formulasR1C1: range.formulasR1C1: Scalar[][]

Formulas in R1C1 notation (“=R[-1]C*2”), values elsewhere.

fullAddress: range.fullAddress: string

“Model!A1:C3”.

link: range.link: string

A link on the top-left cell: a URL, or “#Sheet!A1” for a place in the workbook.

look: range.look: Readonly<CellFormatInput>

The top-left cell’s look.

range.merge(): this

Merges the range into one cell (the top-left keeps its value).

note: range.note: string

A hover note on the top-left cell.

numberFormat: range.numberFormat: string | undefined

The top-left cell’s number format.

range.offset(rows: number, columns: number): Range

The same size, moved by rows and columns.

range.resize(rows: number, columns: number): Range

The same top-left, with a new size.

rowCount: range.rowCount: number

How many rows the range spans.

range.setBorder(where: BorderWhere, border: string): this

Draws borders on part of the range: “outside” (around it), “inside” (between cells), “all”, one side, or “insideHorizontal” / “insideVertical”. range.setBorder("outside", "medium slate-500").

range.setBorder("outside", "medium slate-500")
value: range.value: Scalar

The top-left cell’s value.

values: range.values: Scalar[][]

What the cells show, row by row: numbers, text, true/false, errors, or null when empty.

range.write(input: unknown): Range

Writes a matrix or one value (see values). Returns the range written, which may be larger.