How to Delete Rows in Google Sheets

- Written by Puneet

excelchamps-free-courses-puneet-gogia

You’re managing a team and tracking their weekly hours in a Google Sheet. Alex has left the company, and you must remove Alex’s row from the data. Or maybe you need to delete multiple rows for several team members who have left the company.

delete-rows-in-google-sheets

There are multiple ways you can use to delete a single row as well as multiple rows.

Methods to Delete Rows in Google Sheets

Below are the methods to delete single and multiple rows in Google Sheets.

  1. Right-Click Menu: Right-click the row number and select “Delete row” from the menu.
  2. Edit Menu: Click on the row header to select it, then go to Edit and select “Delete Row.”
  3. Keyboard Shortcuts: Select the row by clicking the row header and use the keyboard shortcut Ctrl + -.
  4. Google App Script: Write code to delete specific rows, all rows with data, or blank rows.

In this tutorial, we will learn all the above methods in detail.

Delete Rows from Right-Click Menu (Single or Multiple)

This is the easiest way to delete rows. You need to select the rows you want to delete and then use the option from the right-click to delete.

delete-rows-from-right-click
  1. To delete rows using the right-click menu, click on the row header to select the row you want to delete.
  2. In the right-click menu, you will see an option that says “Delete Row”; click this option to remove the row.

If you want to delete multiple rows, select them with your mouse and right-click the “Delete Rows” option from the menu. For example, if you want to delete rows 2, 3, and 4, select them first and right-click.

The moment you right-click, you are shown the option “Delete Rows 2-4.” Google Sheets is smart enough to know which rows you have selected.

delete-multiple-rows

You need to select the option to delete the rows. If you have rows that are not continuous, you need to select those rows first by one, right-click, and select the option to delete them.

You can also delete a row just by selecting a cell; when you select a cell, right-click and select the option “Delete Row”, which will delete the active cell’s row.

delete-row-by-selecting-a-cell

Note: When you delete a row or multiple rows in Google Sheets, the rows below the deleted ones automatically shift up to fill the gap.

See this also: Remove Blank Rows in Google Sheets

Use Edit Menu to Delete Rows

The same option can also be accessed from the “Edit” menu. This option works the same as the right-click menu.

edit-menu-to-delete-rows
  1. First, to delete rows using the Edit menu, start by selecting the rows you want to remove.
  2. Once the rows are selected, go to the top of the window and click on the “Edit” menu in the toolbar.
  3. After that, click on the “Delete” option in the edit menu.
  4. Now, in the “Delete” option, you have a further option saying “Row 2-4”, if you have selected rows 2 to 4.
  5. In the end, click on this option to delete rows.

You can use this option to delete a single or multiple rows.

Note: Deleting rows can affect formulas and references in other parts of your worksheet, so double-check your formulas after deletion. Or, use the “Undo” option (Ctrl+Z) immediately if you accidentally delete the wrong rows.

See this also: Insert Multiple Rows in Google Sheets

Keyboard Shortcut to Delete the Rows in Google Sheets

If you want to delete a row with a keyboard shortcut, select it first. To select a row, you have two options.

One is to select it from the header using the mouse, as we have used in the above methods.

The second is to select a cell from the row and then use the keyboard shortcut Shift + Space. This will select the row entirely.

After that, you can use the keyboard shortcut Ctrl + - (Minus) to delete the row.

The keyboard shortcut will instantly delete the selected row or rows from the sheet. It’s a quick and efficient way to manage your data without using the mouse.

If you don’t want to select the row before deleting it, you can use the keyboard shortcut Ctrl +—(Minus). This will open the menu, where you can select the option with the mouse to delete the active cell’s row.

shortcut-to-delete-rows

See this also: Unhide Rows in Google Sheets

Automatically Detele Rows with Google App Script Code

Here’s a Google Apps Script to delete single or multiple rows in Google Sheets. In this script, you can specify the row numbers to delete.

function deleteRows() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();

// Specify the row numbers to delete
var rowsToDelete = [2, 4, 6]; // Example: Delete rows 2, 4, and 6

// Sort the array in descending order
rowsToDelete.sort(function(a, b){return b-a});

// Loop through the array and delete rows
for (var i = 0; i < rowsToDelete.length; i++) {
sheet.deleteRow(rowsToDelete[i]);
}
}

To use this script, click on Extensions > Apps Script. Paste the code above and modify the rowsToDelete array to include the row numbers you want to delete. Save the script with a name (e.g., “DeleteRows”) and then click the play button (▶️) to run the script.

Deleting Rows on Mobile (iOS & Android)

To delete a row or multiple rows when you are using Google Sheets in a Mobile App (iOS or Android):

  1. Tap on the row header on the left side of the screen to select the row you want to delete. Tap and hold the first-row header for multiple rows, then drag to select more rows.
  2. Now, tap again on the selected row number. A menu will appear on the screen.
  3. In the end, in the menu that appears, tap “Delete row.”
delete-rows-on-mobile

This will remove the selected row or rows from your sheet.

What Happens When You Delete Row in Google Sheets

When you delete a row from a sheet, the selected row is completely removed. This means all the data in that row, including any text, numbers, or formulas, is deleted. The rows below the deleted row move up to fill the gap.

Deleting a row can also impact any formulas or charts that reference the deleted row. If a formula used data from the deleted row, it might show an error or change its result. Similarly, charts that include the deleted row will update to exclude that data.

See Deleted Rows in Google Sheets

One thing that fewer users know about Google Sheets is that when you delete rows, the action is recorded in the version history, allowing you to revert to previous versions of the sheet where the deleted rows still exist.

see-deleted-rows

Click on “File” in the toolbar, select “Version history,” and then “See version history”. In the version history, browse through the different versions of your sheet. Click on a version that contains the rows you want to restore. Click “Restore this version” to revert your sheet to that version with rows.

Last Updated: June 17, 2024