I have a Google Docs SpreadSheet, where in the column A are dates (A1: 2013-11-22, A2: 2013-11-23, A3: 2013-11-24 etc). I would like to automatically highlight - set a backg
You could also just have a new column in the spreadsheet do the date matching and return a flag if it's today...
=ARRAYFORMULA(IF(A1:A =TODAY(), 1, "")) - formula in cell D1
then try..
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName('Sheet1');
function onOpen() {
var values = ss.getRange('D1:D').getValues(); // column of date flag
for ( var row = 0; row < values.length; row++ ) {
if ( values[row][0] ) {
break; // assuming only 1 row has today's date
}
}
s.getRange('A1:D').setBackground(null); // range to clear
s.getRange(row + ":" + row).offset(1, 0).setBackground('yellow');
}