function isHoliday(date) { date =new Date(date.setHours(0,0,0,0)); var spreadsheet = SpreadsheetApp.openByUrl( 'MY GOOGLE SPREADSHEET WWW LINK'); var regular = spreadsheet.getSheets()[0].getRange("A:A").getValues(); var iregular = spreadsheet.getSheets()[1].getRange("A:A").getValues(); for (var i = 0; i < regular.length; i++) { if(regular[i][0]!=''){ var year = new Date(date).getYear(); if (new Date(new Date(regular[i][0]).setYear(year)).toString()== date.toString()) { return true; } } } for (var i = 0; i < iregular.length; i++) { if(iregular[i][0]!=''){ if (new Date(iregular[i][0]).toString() == date.toString()) { return true; } } } return false; } function setHolidaySensor() { var sensorUrl= 'MY VIRTUAL SENSOR WWW LINK ENDING WITH ='; if (isHoliday(new Date())==true) { UrlFetchApp.fetch(sensorUrl + '1'); } else { UrlFetchApp.fetch(sensorUrl + '0'); } }