如何解析具有特定主题行的gmail并在google工作表中填充

时间:2018-05-15 04:35:46

标签: google-apps-script

我试过的代码无法获取具体主题的电子邮件,请告诉我下面提到的脚本中的错误

尝试了下面提到的脚本,但仍然无效:

function amy() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = ss.getActiveSheet();
  var threads = GmailApp.search('subject: "New submission from Free Diagnosis*"');
  var a=[];
  for (var i = 0; i < threads.length; i++) {
    var messages = GmailApp.getMessagesForThread(threads[i]);
    for (var j = 0; j < messages.length; j++) {
      a[j]=parseMail(messages[j].getPlainBody());
    }
  }
  var nextRow=s.getDataRange().getLastRow()+1;
  var numRows=a.length;
  var numCols=a[0].length;
  s.getRange(nextRow,1,numRows,numCols).setValues(a);
}

0 个答案:

没有答案