-1

In a google sheet i use the following code to delete an entire row :

function deleteRows() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = ss.getSheetByName('Blad1');
  var r = s.getRange('D:D');
  var v = r.getValues();
  for(var i=v.length-1;i>=0;i--)
    if(v[0,i]=='4 - Approved')
      s.deleteRow(i+1);
};

It says that when the text : 4 - approved is showing in a cell... then he will delete the whole row. That is oke.

But i need a code for the following.

When the text : "4 - approved" or "5 - Good" is in a cel then he need to delete the line, not only with 4 - approved...

Rubén
  • 34,714
  • 9
  • 70
  • 166
TOFF
  • 1

1 Answers1

0

Replace

if(v[0,i]=='4 - Approved')

by

if((v[0,i]=='4 - Approved') || (v[0,i]=='5 - Good'))

Related

Rubén
  • 34,714
  • 9
  • 70
  • 166