class SpreadsheetApp method .deleteRows()

SpreadsheetApp is the Apps Script service.

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

What it does

Deletes multiple rows starting at a given position.

Why it's used

  • Bulk-remove empty or duplicate rows after a cleanup pass.
  • Shrink a sheet after archiving old records elsewhere.

Common errors

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

Explore

Related methods

Better Sheets tutorials

Google Maps Scraper for Outreach

Google Maps Scraper for Outreach

Get this fun template to search on google maps via API, and quickly mess...
How to Power Testimonials with Google Forms and Sheets

How to Power Testimonials with Google Forms and Sheets

I show you how I use a Google Form and a Google Sheet to power the testi...
Ultimate Prompt Writer and Prompt Rater

Ultimate Prompt Writer and Prompt Rater

Create a chat interface inside of Google Sheets using GPT-4. Insert rows...
Visicalc 2023 Design Walkthrough

Visicalc 2023 Design Walkthrough

Design walkthrough of VisiCalc 2023. Watch this if you'd like to see the...
Visicalc 2023 Quick Walkthrough

Visicalc 2023 Quick Walkthrough

This is a fun template I created for April 1st. Take a quick walk throug...

Related blog posts

Written guides about SpreadsheetApp.deleteRows().

Browse the blog