ReferenceAPI
Range
Cells: values, formulas, formats, and reading them back.
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. |
range.address
Section titled “range.address”address: range.address: string“A1:C3” (or “B2” for one cell).
range.bounds
Section titled “range.bounds”bounds: range.bounds: Readonly<RangeAddress>Top-left row and column (0-based) and the bottom-right ones.
range.cell
Section titled “range.cell”range.cell(row: number, column: number): RangeOne cell of the range, 0-based from its top-left.
range.clear
Section titled “range.clear”range.clear(what: "all" | "contents" | "formats"?): thisClears values and formulas, formats, or both (default).
range.columnCount
Section titled “range.columnCount”columnCount: range.columnCount: numberHow many columns the range spans.
range.fillDown
Section titled “range.fillDown”range.fillDown(): thisCopies the top row (values, formulas adjusted per row, formats) into the rows below it.
range.fillRight
Section titled “range.fillRight”range.fillRight(): thisCopies the left column into the columns to its right.
range.format
Section titled “range.format”range.format(input: CellFormatInput): thisApplies 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" })range.formula
Section titled “range.formula”formula: range.formula: string | undefinedThe top-left cell’s formula, or undefined.
range.formulaR1C1
Section titled “range.formulaR1C1”formulaR1C1: range.formulaR1C1: string | undefinedThe top-left cell’s formula in R1C1 notation, or undefined.
range.formulas
Section titled “range.formulas”formulas: range.formulas: Scalar[][]Formulas (“=B2*2”) where cells have them, values elsewhere.
range.formulasR1C1
Section titled “range.formulasR1C1”formulasR1C1: range.formulasR1C1: Scalar[][]Formulas in R1C1 notation (“=R[-1]C*2”), values elsewhere.
range.fullAddress
Section titled “range.fullAddress”fullAddress: range.fullAddress: string“Model!A1:C3”.
range.link
Section titled “range.link”link: range.link: stringA link on the top-left cell: a URL, or “#Sheet!A1” for a place in the workbook.
range.look
Section titled “range.look”look: range.look: Readonly<CellFormatInput>The top-left cell’s look.
range.merge
Section titled “range.merge”range.merge(): thisMerges the range into one cell (the top-left keeps its value).
range.note
Section titled “range.note”note: range.note: stringA hover note on the top-left cell.
range.numberFormat
Section titled “range.numberFormat”numberFormat: range.numberFormat: string | undefinedThe top-left cell’s number format.
range.offset
Section titled “range.offset”range.offset(rows: number, columns: number): RangeThe same size, moved by rows and columns.
range.resize
Section titled “range.resize”range.resize(rows: number, columns: number): RangeThe same top-left, with a new size.
range.rowCount
Section titled “range.rowCount”rowCount: range.rowCount: numberHow many rows the range spans.
range.setBorder
Section titled “range.setBorder”range.setBorder(where: BorderWhere, border: string): thisDraws 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")range.value
Section titled “range.value”value: range.value: ScalarThe top-left cell’s value.
range.values
Section titled “range.values”values: range.values: Scalar[][]What the cells show, row by row: numbers, text, true/false, errors, or null when empty.
range.write
Section titled “range.write”range.write(input: unknown): RangeWrites a matrix or one value (see values). Returns the range written, which may be larger.