I have a conditional fomatting applyed using "whenTextEqualTo" case. This works fine and the cell, which meets this conditions highlighted as desired. However, I would like to have the row to be highlighted , in which this cell is found.
So, the sheet FinData has data located in range from A2 to G500. The value I am checking is in the column F (value should be == "CDI"). When this is met, the cell is highlighted . How to do the same but with the row being highlighted , i.e. col B to col G inclusively. I have checked this post but could not incorporate it into mine below:
function formatCDI() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var finDataSheet = ss.getSheetByName("FinData");
var range = finDataSheet.getRange("A2:G500");
finDataSheet.clearConditionalFormatRules();
var rule = SpreadsheetApp.newConditionalFormatRule()
.whenTextEqualTo("CDI")
.setBackground("#86D3FF")
.setRanges([range])
.build();
var rules = finDataSheet.getConditionalFormatRules();
rules.push(rule);
finDataSheet.setConditionalFormatRules(rules);
};
Would apprecaite any help on this. Thank you,