自制运动打卡记录电子表如何设置提醒功能?

自制运动打卡记录电子表

    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,转转请注明出处:https://www.ihr360.com/hrnews/20241226591.html

(0)
上一篇 2天前
下一篇 2天前

相关推荐