Skip to content

Instantly share code, notes, and snippets.

@danromero
Created November 6, 2013 18:27
Show Gist options
  • Save danromero/7341512 to your computer and use it in GitHub Desktop.
Save danromero/7341512 to your computer and use it in GitHub Desktop.
Simple Gmail inbox to spreadsheet script. Useful for running pivots on "Contact Us"-type emails (e.g. [email protected]).
function processInbox() {
// get all threads in inbox
var threads = GmailApp.getInboxThreads();
for (var i = 0; i < threads.length; i++) {
// get current active Google Docs spreadsheet
var sheet = SpreadsheetApp.getActiveSheet();
// get subject, to, from and date of 1st message in thread
sheet.appendRow([threads[i].getMessages()[0].getSubject(), threads[i].getMessages()[0].getTo(), threads[i].getMessages()[0].getFrom(), threads[i].getMessages()[0].getDate()]);
Utilities.sleep(1000);
}
};
@TeoVanUlden
Copy link

Method "appendRow" can't be called from zero - why does that happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment