Skip to content

Instantly share code, notes, and snippets.

@yepher
yepher / .gs
Created March 11, 2024 23:06
Google Sheet, count number of message out of first 760 messages that use outlook compatibility in the body
function countEmails() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.clear(); // Clear the sheet before writing new data
sheet.appendRow(["Total Emails", "HTML Emails", "Text Emails", "[if (mso) in HTML"]);
// Fetch emails from the Inbox
const threads = GmailApp.getInboxThreads();
let totalEmails = 0;
let htmlEmails = 0;
let ifMsoEmails = 0;