Posted October 16, 2023
A more advanced way to automate your spreadsheets is to integrate Google Scripts into your workflow. For professionals using Google Suite, the hidden gem of Google Scripts can transform tedious tasks into automated processes. While this does require some basic knowledge of coding (e.g. javascript), there are free resources to help you quickly overcome this (check out our blog post on How to Generate Code with ChatGPT: No Experience Needed!). In today’s article we'll explore how you can set up a simple script to track and send reminders for upcoming deadlines.
Imagine you're managing a project with various deliverables, each with its own deadline. Keeping track and reminding yourself or your team about these deadlines can become cumbersome, especially when juggling multiple projects.
A Google Script can automate this! Here's a straightforward script that, when applied to a Google Sheet, will scan for upcoming deadlines and send email reminders. This script will send an email reminder to all task owners whose deadline is within 3 days.
1. Setting up Your Google Sheet
Create a Google Sheet with the following columns:
2. Writing the Google Script
Extensions
> Apps Script
.function sendDeadlineReminder() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = sheet.getDataRange().getValues();
for (var i = 1; i < range.length; i++) {
var row = range[i];
var taskName = row[0];
var deadline = new Date(row[1]);
var emailAddress = row[2];
var reminderSent = row[3];
var today = new Date();
var timeDiff = Math.abs(deadline.getTime() - today.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
if(diffDays <= 3 && reminderSent === 'No') {
var subject = 'Upcoming Deadline Reminder';
var message = 'Hi there, just a reminder that the deadline for ' + taskName + ' is in ' + diffDays + ' days!';
MailApp.sendEmail(emailAddress, subject, message);
sheet.getRange(i + 1, 4).setValue('Yes');
} } }
3. Scheduling the Script:
sendDeadlineReminder
for the function to run, setting the event source to Time-driven
, and choosing the time of day you want it to run.4. Testing Your Result:
For those interested in a step-by-step walkthrough, be sure to check out the video above!
With just a few lines of code, you've transformed your Google Sheet into an automated deadline reminder tool! This example showcases the power and potential of Google Scripts, opening doors for countless other automation opportunities. Looking to dive deeper into automation? Stay tuned in with Excelerated Consulting; we're dropping content like this twice a week!
Not sure what service is right for you? Reach out to Excelerate Consulting for expert insights and solutions tailored to enhance your business operations and financial efficiency. Let's explore opportunities for growth together.