I am writing this script to change the formatting of a row of checkboxes that total 0 selections. In my data validation, "true" = 1 and "false" = 0. The range is represented as an object [ ][ ].
The logic below determines which rows need to be formatted, but how do I actually apply the formatting to this row? I am having trouble accessing the row's formatting because I am working at the value level with the resulting object [ ] [ ].
Here is what the end result should look like: Camping Gear Tally
(I recognize there is probably an easy way to do this with conditional formatting built in, but I'm just trying to get better at coding)
function updateFormatting() {
var cellValues = SpreadsheetApp.getActiveSheet()
.getRange("C2:I37")
.getValues();
for (let i = 0; i < cellValues.length; i++) {
let rowTotal = 0;
for (let j = 0; j < cellValues[i].length; j++) {
rowTotal += cellValues[i][j];
}
if (rowTotal == 0) {
/* Apply formatting to this row */
}
}
}
Thank you for your guidance!