Skip to content

Instantly share code, notes, and snippets.

@fabianem
fabianem / Code.gs
Last active November 28, 2025 18:30
Google Apps Script to count emails by sender in batches
// Google Apps Script for counting emails by sender in batches. Stopps and resumes after 5mins of processing to avoid reaching script runtime limit.
// 1. Allow required permissions
// 2. Add gmail service to project
// 3. Fill <your-email> in `runProcessor` function and adjust query if needed
// 4. Run function `runProcessor`
// 5. Result will be saved in a new spreadsheet
// Based on ideas from https://stackoverflow.com/a/59222719/5162536 and
// https://medium.com/geekculture/bypassing-the-maximum-script-runtime-in-google-apps-script-e510aa9ae6da
### Keybase proof
I hereby claim:
* I am roycewilliams on github.
* I am royce (https://keybase.io/royce) on keybase.
* I have a public key whose fingerprint is E340 0759 8E06 DE8F 6CB8 DC33 501C 0AB5 1776 A531
To claim this, I am signing this object:
i
me
my
myself
we
our
ours
ourselves
you
your