Created
November 6, 2013 18:27
-
-
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]).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Method "appendRow" can't be called from zero - why does that happen?