0

I currently have this code:

var sheet = SpreadsheetApp.getActiveSheet();
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();


function getEmails() {
  var label = GmailApp.getUserLabelByName("Reservation confirmed");
  var threads = label.getThreads();
  var row = 2;
  for (var i = 0; i < threads.length; i++) {
    var messages=threads[i].getMessages();
    for (var m=0; m < messages.length; m++) {   
      sheet.getRange(row,1).setValue(messages[m].getPlainBody());
      row++;
    }
  }
}

function onOpen() {
  var menuEntries = [ {name: "Load Emails", functionName: "getEmails"} ];
  spreadsheet.addMenu("Email", menuEntries);
}

It extracts the body of certain emails I have tagged. I need help writing a code to then sift through the HTML body of the email and extract dates that are formatted as: ‌A‌p‌r‌ ‌0‌1‌,‌ ‌2‌0‌1‌8‌. Jun 21, 2018. etc

2
  • See this answer stackoverflow.com/questions/48974647/… Commented Mar 25, 2018 at 11:51
  • Well, where is the code you have that is not working correctly? You want to apply a multi-line regular expression ("regex"), so I recommend you use a regex testing website, several example emails, and develop a pattern that will work. Commented Mar 25, 2018 at 13:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.