class SpreadsheetApp method .deleteRow()

SpreadsheetApp is the Apps Script service.

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

What it does

Deletes a single row from the sheet.

Why it's used

  • Remove a single bad row after validation fails.
  • Delete the header row from a pasted import in one step.

Common errors

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

Explore

Related methods

  • .deleteRows()

    Deletes multiple rows starting at a given position.

  • .deleteSheet()

    Removes a sheet tab from the spreadsheet.

  • .appendRow()

    Adds a new row of data at the bottom of the sheet.

  • .insertRows()

    Inserts one or more blank rows at a given position.

  • .clear()

    Removes values, formatting, and notes from a range.

Better Sheets tutorials

Automated Project Management in Google Sheets

Automated Project Management in Google Sheets

Create automatic notifications when a project is assigned, a project nee...
Automate Google Sheets With Zero Experience

Automate Google Sheets With Zero Experience

By the end of this video you should be knowledgeable about how to automa...
Automate Move Blank Rows

Automate Move Blank Rows

Automate the apps script we just created that moves blank rows from one ...
Basic CRM - Add a Powerful Script To Move Row Based on Status

Basic CRM - Add a Powerful Script To Move Row Based on Status

we're going to be adding a very powerful script to our CRMs or any datab...
CRM Automations

CRM Automations

Simple automations you can add you to your CRM to keep it clean and look...
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...
I Created an Automatic Emailer

I Created an Automatic Emailer

While creating SheetOps, a new product, I came up with this idea of an a...
Idea Graveyard - Create a Decaying Checklist

Idea Graveyard - Create a Decaying Checklist

Build a simple function that deletes undone items in our checklist.
Move Blank Rows

Move Blank Rows

Apps Script function to move all blank rows if a certain column is not f...
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...
Sheet Stories / Video Notes + Clear 24 Hour Old Videos

Sheet Stories / Video Notes + Clear 24 Hour Old Videos

Revolutionary Method to Manage Your Video Stories! Learn how to delete o...

Related blog posts

Written guides about SpreadsheetApp.deleteRow().

Browse the blog