apps-script-utils 2.1.1 Help

appendRows

function appendRows( target: GoogleAppsScript.Spreadsheet.Sheet | GoogleAppsScript.Spreadsheet.Range, values: unknown, options: AppendRowsOptions | null | undefined = {} ): GoogleAppsScript.Spreadsheet.Sheet;

Pass a sheet and the whole sheet is examined, with the write starting in column 1; pass a range and only its cells are, with the write landing on the range's columns — data elsewhere on the sheet no longer decides where the block goes.

Nothing is overwritten: the write starts one row below the last one holding data, and 0 and false count as data. The sheet gains rows when it is too short for the result. Unlike Sheet#appendRow, which takes one row at a time, the whole block is written in a single call.

A cell whose text starts with = is written as a formula, not as text — the same rule the editor follows.

A failure inside the write — the service unavailable, the sheet gone — comes back as the error the service raised, with its stack. The document lock is released either way.

Parameters

Parameter

Type

Description

target

GoogleAppsScript.Spreadsheet.Sheet \| GoogleAppsScript.Spreadsheet.Range

The sheet to append to, or the range to append within.

values

unknown

A matrix of rows: one array per row, all of the same length.

options (optional) = {}

AppendRowsOptions \| null \| undefined

afterFrozenRows starts the write below the frozen rows when the data ends before them.

Returns

GoogleAppsScript.Spreadsheet.Sheet — the sheet, so calls can be chained.

Throws

Exception

Condition

IllegalArgumentException

no argument is passed.

InvalidSheetException

the first argument is neither a sheet nor a range.

TypeError

the values are not a matrix with rows of equal length.

Examples

Appending to a sheet

const sheet = SpreadsheetApp.getActiveSheet(); appendRows(sheet, [ ["Ada", "ada@example.com"], ["Grace", "grace@example.com"] ]);

Appending within a range

const sheet = SpreadsheetApp.getActiveSheet(); appendRows(sheet.getRange("B1:C10"), [["Ada", "ada@example.com"]]);

See also

Source

src/appsscript/sheet/appendRows.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.