Monday, February 24, 2025

How to get Automatic Expiry Alert



Managing expiry dates for various items can be challenging, especially if you have numerous items to track. Google Apps Script offers a convenient way to automate this task by sending email notifications when items are nearing their expiry date or have already expired. In this post, I'll show you how to set up a script to track expiry dates and send stylish email alerts.Copy the AppScript code below:


First, set up a Google Sheet with the following structure:

Column A: Item Name Column B: Expiry Date Column C: Approaching Expiry Threshold (in days)

Here's an example of how your sheet might look:

Item Name Expiry Date Threshold
Vehicle Insurance 28/07/2024 3
Pollution Certificate 26/07/2024 2
VitaminD 29/07/202 5



Name this sheet Sheet1.

Next, use the following Google Apps Script to check expiry dates and send email notifications:

To run the script, open the Script Editor in Google Sheets (Extensions > Apps Script), paste the script, and save it. You can set up a time-driven trigger to run this script daily or at a frequency that suits your needs (Triggers > Add trigger).


The message will look like this

The following items have expired:

Item Name Days
Vehicle Insurance 0
pollutionCertificate -2

The following items are approaching expiry:

Item Name Days
vitaminD 1

No comments:

Post a Comment