Created
November 1, 2024 10:19
-
-
Save danielcranney/793eb931f7a23d9d3a1f250e8023894a to your computer and use it in GitHub Desktop.
newsletter unsubscription tracker / 04 - connect to Google sheet.js
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
// Logs emails from threads labeled "unsubscribed" to a Google Sheet | |
function logUnsubscribes() { | |
var label = GmailApp.getUserLabelByName('unsubscribed'); // Fetch the "unsubscribed" label from Gmail | |
var threads = label.getThreads(); // Get all threads with this label | |
var sheet = SpreadsheetApp.open(DriveApp.getFileById('REPLACE_WITH_GOOGLE_SHEET_ID')); // Open the target Google Sheet | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment