How To Quickly Delete Rows In Google Sheets

Google Sheets is a versatile cloud-based spreadsheet solution that provides a host of features to effectively manage and analyze data. One such feature is the ability to delete rows. Whether it’s for data cleaning purposes or just to remove unnecessary information, knowing how to quickly delete rows in Google Sheets can save you a lot of time. In this blog post, we will guide you on how to get it done.

Method 1: Manually Deleting Rows

The most straightforward way to delete rows in Google Sheets is to do it manually. Follow these steps:

  1. Open your Google Sheets document.
  2. Select the row you want to delete by clicking the row number.
  3. Right-click the selected row.
  4. Click on “Delete Row” in the drop-down menu.

That’s it! You have successfully deleted a row in Google Sheets. However, this method can be time-consuming if you have to delete many rows. Here’s where Method 2 comes in handy.

Method 2: Using a Script to Delete Rows

Google Sheets allows us to use Apps Script, a rapid application development platform, to automate tasks. Here’s how you can create a script to delete rows that meet a certain condition:

  1. Click on Extensions -> Apps Script.
  2. Copy and paste the following script:

    function deleteRows() {
        var sheet = SpreadsheetApp.getActive().getSheetByName('Sheet1');
        var rows = sheet.getDataRange();
        var numRows = rows.getNumRows();
        var values = rows.getValues();

        for (var i = numRows - 1; i >= 0; i--) {
            var row = values[i];
            if (row[0] == 'delete') {
                sheet.deleteRow(i + 1);

In the script above, replace ‘Sheet1’ with the name of your sheet and ‘delete’ with the condition that decides which rows to delete. The script will go through each row in the sheet. If the first cell in a row matches the condition, the script will delete that row.

Now, let’s run the script:

  1. Click on the current function (select ‘deleteRows’ from the dropdown).
  2. Click on the run button (play icon).

And there you have it! You’ve now learned how to quickly delete rows in Google Sheets using Apps Script.

Remember to use this function wisely because once the rows are deleted, there is no undo button. Make sure to always have a backup of your data before running the script. Happy data cleaning!