0

我每天都在电子邮件正文中发送电子表格。我完成了电子邮件部分,但现在我试图将触发器编程为每天下午 1:15 出发。我不确定如何实现代码以通过电子邮件触发?

'function nearMinute(minute) {
     var sendRead = ScriptApp.newTrigger("sendRead1pm")
          .timeBased()
          .atHour(13)
          .everyDays(1) // Frequency is required if you are using atHour() or atMinute()    
          .create();

     var ss = SpreadsheetApp.getActiveSpreadsheet();
     var sheet = ss.getSheetByName("Totals");

     var subjecttable = UrlFetchApp.fetch("https://docs.google.com/spreadsheet/pub?
     key=XXXXXXXXXXXXXXXXXXXXXXXXXXX=true&gid=1&output=html");
     var htmltable = subjecttable.getContentText();

     var fromName =  "DoNotReply - email";
     var rowData = ss.getRange("B16").getValues()[0];
     var emailAddress = "emailaddress@gmail.com";       // First column
     var message = {htmlBody: htmltable, name: fromName};       // Second column
     var subject = "TEST $" + rowData;

     MailApp.sendEmail(emailAddress, subject, "", message);

 }`    
4

1 回答 1

0

您不必编写触发器代码。使您的功能执行电子邮件部分并手动设置触发器。在您的脚本中,转到Resources --> Current Project's Triggers然后添加触发器。这是最简单的。

于 2013-06-13T05:04:10.167 回答