Last active
June 2, 2022 20:09
-
-
Save rooreynolds/57a5bee6f6938af7f65b0739c7604512 to your computer and use it in GitHub Desktop.
Gmail email stats (Google Sheets script)
This file contains 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 CountEmail() { | |
var starredEmails = GmailApp.search('is:starred'); | |
var newunreadEmails = GmailApp.search('is:unread label:inbox'); | |
var urgentEmails = GmailApp.search('label:urgent'); | |
var waitingEmails = GmailApp.search('label:waiting-for'); | |
var chaseEmails = GmailApp.search('label:chase'); | |
var draftEmails = GmailApp.search('in:draft'); | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1"); | |
var date = new Date(); | |
sheet.appendRow([date, | |
starredEmails.length, | |
newunreadEmails.length, | |
urgentEmails.length, | |
waitingEmails.length, | |
chaseEmails.length, | |
draftEmails.length]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment