-2

I want to delete the entire row if the cell in column A has any content.

I'm new to this, but I've tried a couple of scripts online.

Here is the link to my spreadsheet.

Community
  • 1
  • 1
  • Possible duplicate of [Deleting rows in google sheets using Google Apps Script](https://stackoverflow.com/questions/37924842/deleting-rows-in-google-sheets-using-google-apps-script) – player0 Jul 11 '19 at 01:08

1 Answers1

2
function delRowIfColA() {
  var ss=SpreadsheetApp.getActive();
  var sh=ss.getSheetByName('Sheet1');
  var rg=sh.getRange(4,1,sh.getLastRow(),sh.getLastColumn());
  var vA=rg.getValues();
  var d=0;
  for(var i=0;i<vA.length;i++) {
    if(vA[i][0]) {
      sh.deleteRow(i+4-d++);
    }
  }
}
Cooper
  • 59,616
  • 6
  • 23
  • 54