甚至连调试器

时间:2017-02-23 17:05:42

标签: google-apps-script

我在Google Spreadsheet上创建了一个非常简单的脚本,需要在一个特定的列中读取字段并发送电子邮件,并且#34;是"之后它标志着另一个单元格被发送到#34; - 避免重复发送。  当试图测试它时,似乎它甚至没有运行调试器。

我以前从来没有这个,有人可以帮忙吗?



function sendMail(){
  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  var hwToCheckValues = sheet.getDataRange().getValues();
  Logger.log(hwToCheckValues[2][5]);
  
  
  
  for (i = 0; i < hwToCheckValues.length; i++){
    if (hwToCheckValues[i][5] == 'Yes' || hwToCheckValues[i][5] == 'yes'){
      if  (hwToCheckValues[i][7] != 'Sent'){
    
      var firstName = hwToCheckValues[i][1];
      var lastName = hwToCheckValues[i][2];
      var emailAddress = hwToCheckValues[i][3];
      var comments = hwToCheckValues[i][7];
      var fileLink = hwToCheckValues[i][9];
      
      var html = [];
      var summary = '';
  
  if (comments != '') {
    summary = 'Your Home Work got checked ' +
        'Comments: ' + comments +
          ' You Can find the file with the full comments here: ' + fileLink;
  } else {
    summary = 'Your Home Work got checked ' +
          ' You Can find the file with the full comments here: ' + fileLink;
  }
  html.push('<html>',
              '<head></head>',
                 '<body>',
                  '<table style="font-family:Arial,Helvetica; ' +
                       'border-collapse:collapse;font-size:10pt; ' +
                       'color:#444444; border: solid 1px #dddddd;" ' +
                       'width="600" cellpadding=20>',
                     '<tr>',
                       '<td>',
                         '<p>Hello,</p>',
                         '<p>' + summary + '</p>',
                         '<p>Cheers<br />Sepreia College Team</p>',
                       '</td>',
                     '</tr>',
                   '</table>',
                 '</body>',
             '</html>'
           );

  if (emailAddress != '') {
    MailApp.sendEmail({
      to: emailAddress,
      subject: 'Your HW got Feedback',
      htmlBody: html.join('\n')
    });
    hwToCheckValues[i][8] == 'Sent';
  }
          }  
  }
  }
}
&#13;
&#13;
&#13;

0 个答案:

没有答案