I have written a Google Apps Script that creates a conditional format on a range. After running the script, the conditional format is created perfectly but it doesn't work on its own: I have to manually enter on Format > Conditional format > Enter the validation I created and save it (without changing a thing) for it to work as it should.
var hojaCamada = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(camada); var range = hojaCamada.getRange("K6:K100"); var rule = SpreadsheetApp.newConditionalFormatRule() .whenFormulaSatisfied('=Y($J6 < $I$3;$K6<1)') .setBackground("#ea9999") .setRanges([range]) .build(); var rules = hojaCamada.getConditionalFormatRules(); rules.push(rule); hojaCamada.setConditionalFormatRules(rules); Can anyone help me figure out what the problem is?