mercredi 20 février 2019

Re-set checkboxes to true (dealing with blanks)- Google Apps Script

I found the snippet below here: Re-set checkboxes to false - Google Apps Script

I'm interested in editing this to set false checkboxes to true, specifically adding to it to skip blank cells. Can't find anything helpful on skipping blanks.

function resetCheckBoxesAllSheets() {
var ss = SpreadsheetApp.getActive();
var allsheets = ss.getSheets();
for (var s in allsheets){
var sheet=allsheets[s]

var dataRange = sheet.getRange('A4:Z100');
var values = dataRange.getValues();
for (var i = 0; i < values.length; i++) {
  for (var j = 0; j < values[i].length; j++) {
    if (values[i][j] == true) {
      values[i][j] = false;
    }
  }
}
dataRange.setValues(values);


}
}



Aucun commentaire:

Enregistrer un commentaire