mardi 7 janvier 2020

If else in Google Script

I want to write a google script that will delete all the cells in column 'N' if row 'R' has the text 'Rejected'. I have written this script but it deleting all the cells in Column 'N'. help me with my error or suggest a better script.

function clean0() {
  var app = SpreadsheetApp;
  var activeSheet = app.getActiveSpreadsheet().getSheetByName('Tasks');

  for (var i = 2; i < 100; i++) {
    var workingCell = activeSheet.getRange(i, 18).getValue();

    if (workingCell = '0') {
      activeSheet.getRange(i, 14).setValue("a");
    } else {

    }
  }
}

Aucun commentaire:

Enregistrer un commentaire