class SpreadsheetApp method .insertRows()

SpreadsheetApp is the Apps Script service.

.insertRows() is the method name you will see after a dot in your code.

What it does

Inserts one or more blank rows at a given position.

Why it's used

  • Make room for a new block of data in the middle of a sheet.
  • Shift rows down before inserting a header or summary section.

Common errors

  • Forgetting parentheses on insertRows. Write SpreadsheetApp.insertRows(), not SpreadsheetApp.insertRows or insertRows by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').insertRows().
  • Adding spaces where they do not belong. Write SpreadsheetApp.insertRows(), not SpreadsheetApp .insertRows(), SpreadsheetApp.insertRows (), or SpreadsheetApp . insertRows().
  • Wrong capitalization. Use SpreadsheetApp and insertRows, not spreadsheetapp or insertrows.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about SpreadsheetApp.insertRows().

Browse the blog