Gmail Counter with Google Apps Script

The following Google Apps Script will display the unread Gmail counter for your mailbox to anyone on the Internet with a simple URL.

The count is published as text but you may use other formats (ContentService.MimeType) like RSS, JSON or even CSV and feed this data into other system – like tweets or even another spreadsheet.