Google Apps脚本失败:基于时间的触发器

时间:2019-06-24 16:13:58

标签: javascript google-apps-script google-sheets

我一直在尝试将基于时间的触发器放入应用脚本时收到失败报告。该脚本旨在每天早晨触发,并根据天数发送电子邮件提醒。

我试图调整正在调用的脚本函数名称,并将触发器的类型从几天更改为几个小时。

function loops() {

    // Runs at approximately 8:30am in the timezone of the script
    ScriptApp.newTrigger('loops')
        .timeBased()
        .atHour(8)
        .nearMinute(30)
        .everyDays(1)
        .create();

    var report = SpreadsheetApp.getActive();
    var ss = SpreadsheetApp.getActiveSpreadsheet()
    var emailList = ss.getSheetByName("Email Reminder");

    var data = emailList.getRange(3, 19, emailList.getLastRow() - 1, 24).getValues();
    //Logger.log(data);

    data.forEach(function (row, i) {
        var id = row[0];
        var customer = row[1];
        var user = row[2];
        var URL = row[3];
        var proposedCount = row[4];
        var pendingCount = row[5];


        if (proposedCount == 36) {
            MailApp.sendEmail(user, customer, customer + " has been in the proposal stage for " + proposedCount + " days." +"\n" +"\n" + URL + "\n" + "\nThis is a reminder to keep this job in front of you :)" + "\n" + "\nYour friendly neighborhood accountability partner");
        }
        if (pendingCount == 15) {
            MailApp.sendEmail(user, customer, customer + " has been in the pending stage for" + pendingCount + " days." + "\n" + "\n" + URL + "\n" + "\nThis is a reminder to keep this job in front of you :)" + "\n" + "\nYour friendly neighborhood accountability partner");
        }
    });
}

我希望发送一封电子邮件,但我一直收到此错误的电子邮件:

  

您的脚本“电子邮件提醒”最近未能成功完成。故障摘要如下所示。

     

19/6/23上午10:52:未找到myFunction脚本函数:基于myFunction的时间6/23/19 10:52

     

19/6/24 10:52 AM:找不到myFunction脚本函数:基于myFunction时间的6/24/19 10:52 AM

0 个答案:

没有答案