我收到了一些从 gmail 到电子表格的特殊电子邮件。但在我将它们发送到电子表格之前。我想从电子邮件纯文本中获取一些特殊数据。例如,文本中有“到达”一词,旁边有日期。我想得到这个日期。
这是我到目前为止所拥有的:
function abepostalar() {
var threads = GmailApp.search('label:AOOA');
Logger.log(threads);
Logger.log(threads[0].getMessages());
Logger.log(threads[0].getMessages().length);
var messages;// = threads[0].getMessages();
var ContentEmail;// = messages[0].getBody();
for (var i = 0; i < threads.length; i++) {
messages = threads[i].getMessages()
ContentEmail = messages[0].getPlainBody();
// These are what I tried to find the word. not working.
//var bilgi = ContentEmail.findText("Uygar");
//var yazi = ContentEmail.asText().getText();
//Logger.log(bilgi);
//MesajlariDosyayaYaz(date); // a function to send date to the spreadsheet
}
}