I\'m trying to do a mass cleanout of my Gmail because search has gotten so slow. I would like to tally how many emails i\'ve received from each sender. The closest solutio
This will get you a unique sender list
function sender_list() {
var inbox_threads=GmailApp.search('in:anywhere');
var sender_array=[];
var uA=[];
for(var i=0;i
and this version adds the number of emails per sender:
function sender_list() {
var inbox_threads=GmailApp.search('in:anywhere');
var sender_array=[];
var uA=[];
var cObj={};
for(var i=0;i
I have about 500 emails total. I don't store a lot of emails and I discard a lot of unwanted emails when they arrive. It took about 20 seconds to run. So I would imagine 100K emails will require you to run this in batches.
Batch Operations
The following code requires that that Gmail API be enabled.
To do a batch you could run this function to start with:
function sender_list_paged(token) {
var token=token||null;
var query="in:anywhere";
var sender_array=[];
var uA=[]
var cObj={};
do{
var result=Gmail.Users.Messages.list("your gmail address", {maxResults:100,pageToken:token,q:query});
var list=result;
Logger.log(list);
for(var i=0;i
And then run the function again like this:
sender_list_paged(getLastPageToken());
function getLastPageToken() {
return PropertiesService.getUserProperties().getProperty("lastpagetoken")
}
And I think that will work. But you may have to play with it as I haven't ever had to do that.