I'm trying to use the following script to change the row colour if a value in column N is set:
function onEdit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Sheet1');
var rows = sheet.getRange('n3:n700');
var numRows = rows.getNumRows();
var values = rows.getValues();
for (var i = 0; i <= numRows - 1; i++) {
for (var x in values[i]){
if (values[i][x] == '4'){
var n = i + 1;
sheet.getRange('a'+n+':n'+n).setBackgroundColor('red');
}
}
}
};
But unfortunately I get the following error message:
Cannot call method "getRange" of null.
I've also tried switching to the new spreadsheets and using conditional formatting with a formula if(n3 = "")
with no joy, and to be honest even if that worked I'm not sure if there is an easy way to apply conditional formatting to each line.