Reputation: 1899
Hello guys I am working on a project where I want to read emails from gmail inbox on a specific date. I have referred the official documentation but it hasn't been much helpful to me.
var master = SpreadsheetApp.openById(<SPREADSHEET_ID>);
var demosheet = master.getSheetByName("demo");
var newDate = Utilities.formatDate(new Date(), "GMT+5:30", "dd/MM/YYYY");
var getdate = demosheet.getDataRange().getValues();
var firstThread = GmailApp.getInboxThreads(0,1)[0];
//to get date from spreadshet
for(i=2;i<getdate.length;i++)
{
Logger.log(firstThread.getLastMessageDate(getdate[i][0])); }}
Can anyone please help, thanks in advance.
Upvotes: 2
Views: 2795
Reputation: 19835
Look at GmailApp.search. Google for search format as its not in the docs. Probably uses syntax 'before:x after:y
Upvotes: 2