the script below returns only records of 500 mails. the google developer help states clearly "Where the thread size is unknown, and potentially very large, please use the 'paged' call, and specify ranges of the threads to retrieve in each call."
what is paged call ? how to do it ?
I have even tried GmailApp.getInboxThreads(start,end)
it displays error if the parameters are >500.
how to read all the 22000 mails in my inbox ?
//google script
function spreadsheetSaver()
{
var emailSheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
emailSheet.clear();
var thread = GmailApp.getInboxThreads();
var row = 1;
for(var i=0;i<thread.length;i++)
{
var mail = thread[i].getMessages();
for(var msg in mail)
{
var message = mail[msg];
if (message && message.isInInbox())
{
var txt = message.getPlainBody();
emailSheet.getRange(row++,1).setValue(txt);
}
}
}
};
the expected output must save all the 22000 mails in a spreadsheet