Google Sheets Email Alert Reminder

This is just my solution to reminders for open items. This uses a combination of Google Sheets & Google Apps Scripts. I am a big fan of using Google Apps Scripts for email notifications/alerts. This example will send up to 3 emails provided columnD does not say “Complete”

Google Sheets Sample Layout

Google Apps Script Code

function sendReminderEmails() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var data = sheet.getRange(2, 1, sheet.getLastRow() - 1, 8).getValues(); // Assuming data starts from row 2

  var today = new Date();
  
  data.forEach(function(row) {
    var task = row[0];
    var expirationDate = row[1];
    var fileDate = row[2];
    var status = row[3];
    var reminderDates = row.slice(4); // Slice reminder dates

    if (status !== "Complete") {
      for (var i = 0; i < reminderDates.length; i++) {
        var reminderDate = reminderDates[i];
        if (reminderDate !== "" && new Date(reminderDate) <= today) {
          sendEmail(task);
          break; // Stop checking further reminder dates for this row
        }
      }
    }
  });
}

function sendEmail(task) {
  var subject = task + " Reminder";
  var recipient = "email@email.com"; // Change this to your email address
  var body = "This is a reminder for task: " + task;

  MailApp.sendEmail({
    to: recipient,
    subject: subject,
    body: body
  });
}

Trigger Setup

I then schedule this to run every day at a set time

Sharing

Related Articles

  • All Post
  • Articles
  • Blog Post
  • General Business Automation
  • Portfolio
  • Stock Market & Finance