I'm transitioning from knowing VBA to Scripts for spreadsheet management. I created a function to flag cells that contain certain words within my spreadsheet.
How do I reference specific cells as it relates the overall code:
The issue is with the following being undefined.
setBackgroundColor("#99CC99")
Would this be appropriate?:
values[i][0].setBackgroundColor("#99CC99")
Code below:
function foo(){
var range = SpreadsheetApp.openById("1oh5wXFi4YM1bDvfF27pu1qHDKQEhn02drtfsrRgxArQ").getSheetByName("General").getRange("D:D");
var values = range.getValues();
for(var i in values){
if(values[i][0].match("Rensselaer")!=null){
setBackgroundColor("#99CC99")
}
if(values[i][0].match("Albany")!=null){
setBackgroundColor("#99CC99")
}
if(values[i][0].match("Saratoga")!=null){
setBackgroundColor("#99CC99")
}
}
}