mardi 25 août 2020

Using IF to evaluate an specific string

I have a Google sheet job planning project and I want to move a row of data to another sheet but only if the job was done by me. I did something like

if(s.getName() == "Job Planning" && r.getColumn() == 4 && r.getValue() == "Complete and Sent") {
   var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("Complete and Sent");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 2, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
} 

the problem is that I can't do something like --

if(name.getValue() == "Miguel") {
} 

As there is more that 1 name in the same textbox or cell.

Aucun commentaire:

Enregistrer un commentaire