function checkWorkoutStatus() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var lastRow = sheet.getLastRow();
var statusColumn = 4; // 假設打卡狀態列為第4列
for (var i = 2; i <= lastRow; i++) {
var status = sheet.getRange(i, statusColumn).getValue();
if (status == "未完成") {
var email = "your_email@example.com"; // 替換為你的郵箱
var subject = "運動打卡提醒";
var body = "您今天還有運動未打卡,請及時完成!";
MailApp.sendEmail(email, subject, body);
}
}
}
function createTimeDrivenTrigger() {
ScriptApp.newTrigger('checkWorkoutStatus')
.timeBased()
.everyHours(1) // 每小時檢查一次
.create();
}
利唐i人事HR社區,發布者:ihreditor,轉轉請注明出處:http://www.ynyjypt.com/hrnews/20241226591.html