Hi!
Hoping someone can assist. I am looking to extract the last contact date for either sent or received emails and send this into a google sheet.
I have the below script from someone online but I don’t know how to iterate this across a number of rows.
TIA
function myFunction() {
// Get the value in the cell A1 (which will have the email to check the latest interaction)
var ss = SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('A1').getValue();
// Search the date of the last message of the search from the email in cell A1 and log it
var latestEmail = GmailApp.search('from:"'+ss+'"')[0].getLastMessageDate();
Logger.log(latestEmail);
// Print the date on the cell to the right
SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('B1').setValue(latestEmail);
}