Skip to content

Instantly share code, notes, and snippets.

@tomrandle
Created October 17, 2016 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomrandle/eae8767a4c8ce6c15f2c4b201c797a32 to your computer and use it in GitHub Desktop.
Save tomrandle/eae8767a4c8ce6c15f2c4b201c797a32 to your computer and use it in GitHub Desktop.
lunchReminder
function lunchReminder() {
var curHour = new Date().getHours();
if (curHour > 17 || curHour < 9) {
Logger.log("Outside work hours stopping");
return
}
var completedValues = sheet.getRange(startRow,1,rowRange,1).getValues();
var slackNames = sheet.getRange(startRow,2,rowRange,1).getValues();
// Loop over the completed rows
for (var i = 0; i < completedValues.length; i++) {
var completed = completedValues[i][0];
if(completed !== "" && completed == false) {
var name = slackNames[i][0];
triggerSlackRequest("@"+name,"*You haven't completed your lunch order*, don't miss out - order now!\n" + sheetURL);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment