SHARE
TWEET

gmail inbox count google spreadsheet script

a guest Jun 22nd, 2013 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. The script as described in http://www.rossgoodman.com/2012/10/26/inbox-zero-and-quantified-self/ ready to copy and paste:
  2.  
  3. function myFunction() {
  4. var doc = SpreadsheetApp.getActiveSheet()
  5. var firstEmptyRow = doc.getLastRow() + 1;
  6. var gmailUnread = GmailApp.getInboxUnreadCount();
  7. var gmailInbox = GmailApp.search('in:inbox').length
  8. var gmailStarred = GmailApp.search('in:starred').length
  9. var gmailSpam = GmailApp.search('in:spam').length
  10. doc.getRange(firstEmptyRow, 1, 1, 1).setValue(new Date().getYear() +"-" + ("0" + (new Date().getMonth() +1)).slice(-2)  + "-" + ("0" + new Date().getDate()).slice(-2));
  11. doc.getRange(firstEmptyRow, 2, 1, 1).setValue(gmailUnread);
  12. doc.getRange(firstEmptyRow, 3, 1, 1).setValue(gmailInbox);
  13. doc.getRange(firstEmptyRow, 4, 1, 1).setValue(gmailStarred);
  14. doc.getRange(firstEmptyRow, 5, 1, 1).setValue(gmailSpam);
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top