Small question about google sheet, script editor code

42 Views Asked by At

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...

1

There are 1 best solutions below

0
On

Replace

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

by

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

Related