Reputation: 441
I have a google sheet that contains dates, I want to change all the tab color if the today date higher than the cell date
I have like 30 tab and each one has the same cell but different date
the cell position: A4
Upvotes: 0
Views: 223
Reputation: 64032
function changeColorIfA4IsEarlierThanToday() {
var ss=SpreadsheetApp.getActive();
var shts=ss.getSheets();
var today=new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()).valueOf();
shts.forEach(function(sh){
var val=sh.getRange('A4').getValue();
if(new Date(val).valueOf()<today) {
sh.setTabColor('#ffff00');
}else{
sh.setTabColor(null);
}
})
}
Upvotes: 2