Deletes a single row from the sheet.
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
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.
Snippets using this method
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.
More Apps Script
Better Sheets tutorials
Automated Project Management in Google Sheets
Automate Google Sheets With Zero Experience
Automate Move Blank Rows
Basic CRM - Add a Powerful Script To Move Row Based on Status
Related blog posts
Written guides about SpreadsheetApp.deleteRow().
Automate Row Deletion in Google Sheets with Apps Script
In this post, we'll cover how to remove rows automatically in Google Sheets using Apps Script, ensuring you save time and streamline your spreadsheet management. You're probably already familiar with the manual way of right-clicking and deleting rows, but there's a more efficient way to handle this—automation! Manual versus Semi-Automatic Deletion You may know that you can manually delete rows in Google Sheets by right-clicking and selecting "Delete row." You can even select multiple rows...
Read post →What's Better Than Google Sheets?
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →How To Use a 1-Cell Google Sheet
Introduction to Tiny Sheets a free google sheet add-on to make tiny spreadsheets. Delete unnecessary rows and columns easily.
Read post →