Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danielcranney/10b26cf1c8c6ca8b6891a4a6d9142d0e to your computer and use it in GitHub Desktop.
Save danielcranney/10b26cf1c8c6ca8b6891a4a6d9142d0e to your computer and use it in GitHub Desktop.
newsletter unsubscription tracker / 08 - isAlreadyLogged() helper function.js
// Helper function to check if an email is already in the sheet
function isAlreadyLogged(email, sheet) {
var data = sheet.getDataRange().getValues(); // Get all values in the sheet
for (var i = 0; i < data.length; i++) {
if (data[i][0] === email) {
return true; // Return true if email is already logged
}
}
return false; // Return false if the email is not in the sheet
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment