What is appendRow in Google Sheets Apps Script?

appendRow adds one new row to the bottom of the first used table on a sheet, filling values left to right across columns. It is the quickest way to log an event, store a form response field set, or push one record without calculating the next row number manually.

When to use it

Use appendRow for single new records: log each onEdit event, save a webhook payload, add a form row from e.values, or queue a job entry with timestamp and user.

When to skip it

Skip appendRow when inserting many rows at once. Build a 2D array and setValues at getLastRow + 1 is faster. Use insertRowBefore when order in the middle of the sheet matters.

How it works

  1. 1

    Call sheet.appendRow([col1, col2, col3]) with a flat array of cell values in column order.

  2. 2

    Apps Script places the row after the current last row of the sheet table.

  3. 3

    {:"Values types follow setValue rules"=>"strings, numbers, dates, booleans."}

  4. 4

    Missing array slots leave trailing cells blank on that row.

  5. 5

    For multi-column consistency, keep array order aligned with your header row.

  6. 6

    Combine with LockService when concurrent triggers might append at once.

Examples in Google Sheets

Audit log

onEdit calls appendRow on a Log sheet with timestamp, user email, sheet name, and edited address from the event object.

Form row mapping

onFormSubmit maps e.values into [id, name, email, answer] and appendRow on Responses mirror tab.

Error queue

catch block appendRow on Errors with message and stack snippet for later review.

Build this without starting from a blank cell

Use a Better Sheets tool for appendRow, then watch a walkthrough when you want the full pattern.

Better Sheets resources

Common mistakes

  • Array column order does not match headers, shifting data into wrong fields.
  • appendRow in a tight loop for thousands of imports instead of batch setValues.
  • Expecting appendRow to start at column B; it always starts at column A unless you pad with empty strings.
  • Not using LockService when two time triggers append simultaneously and interleave partial rows.
  • Appending to the wrong sheet because getActiveSheet changed during the run.

Frequently asked questions

Does appendRow need getLastRow first?
No. appendRow finds the next row automatically. getLastRow is useful when you use setValues instead.
Can appendRow append multiple rows?
One row per call. Loop or switch to setValues for bulk inserts.
What sheet does appendRow use?
The Sheet object you call it on. Get the tab with getSheetByName before appendRow.
Does appendRow expand the sheet forever?
Each append adds a row. Archive old data periodically on high-volume logs.
Will appendRow trigger onEdit?
It can, because the grid changes. Design onEdit to ignore the Log tab or script columns.
Can I append formulas?
Pass strings starting with = in the array. They become formulas in the new row.
How is appendRow different from insertRowBefore?
appendRow adds at the bottom. insertRowBefore shifts existing rows down at a chosen index.
Why are my columns shifted?
Your array length or order does not match the sheet layout. Pad early columns with empty strings if column A is unused.

Related Tutorials

Watch how appendRow works

Browse more tutorials
How to Insert Multiple Rows in Google Sheets (Easy to Hard)

How to Insert Multiple Rows in Google Sheets (Easy to Hard)

Learn how to add multiple rows to your google sheets by hand, and automa...
Convert Google Sheets into a REST API

Convert Google Sheets into a REST API

How to use Google Sheets as a database by turning it into a REST API wit...
Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script

Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script

This is one of the most popular asked first "automations". How to move a...
Dylan Asks: How to Automatically Delete Rows If Cell Contains Value

Dylan Asks: How to Automatically Delete Rows If Cell Contains Value

Find out how to automatically delete rows based on a cell's value. We do...
Scrape Google Maps

Scrape Google Maps

Scrape any query in Google Maps into your Google Sheets. Enter your API ...
Calculate ROAS in Google Sheets

Calculate ROAS in Google Sheets

Calculate Return on Ad Spend with a formula combination. Bonus: create a...

Related blog posts

Guides that explain appendRow in more depth.

Browse the blog

Related glossary terms

Done reading about appendRow?

Membership unlocks 636+ tutorials, unlimited generators, and every template. Practical lessons. Zero fluff.

Need this once

Jump to a free tool or a single tutorial for this topic.

Learning Sheets for real

Unlock the full library, generators, and templates with membership.