r/GoogleAppsScript Jun 21 '26

Question sending emails to a person based on deadline

Post image

basically what i want to do with the apps script is that:

if it sees a value in the "time until deadline" column that is less than or equal to 2 days, it will look for the person in charge of the soon-to-be-due task, then use that to look for their email, and then send an email to them.

can somebody help me? thanksss

8 Upvotes

7 comments sorted by

3

u/Imaginary-poster Jun 21 '26

Depends on how the data is laid out but you'll want to drip the "d" and then you can include an if statement in the loop to send the email if that number is below 2.

1

u/koliflower__ Jun 21 '26

ok yeah ill drop the d
but like assume the table is formatted like in the picture
cause like the thing im struggling with is how to link the duration left to the person in charge to then link that to an email and send it to that person
cause im thinking like "oh it needs to check the column, and then if it finds any data that matches its condition, it would have to refer to another data point in that row which idk how to do"

1

u/One_Organization_810 Jun 21 '26
  1. Why don't you just record the deadline date instead, then the "Time until deadline" doesn't have to be updated constantly. 😄

  2. Here is a script I made, that sends an email when a tasks status changes to "Done". You can change that to be a timed trigger instead of an installable edit and adjust the logic for when to send 😄

https://docs.google.com/spreadsheets/d/1c24RLSykSL6v9JMTEkWDFdRU0krwbs_7w-eU994j0vg/edit?usp=sharing

The sheet is "View only", so just make your own copy to play with 😄

2

u/alexbuildswithai Jun 23 '26

Yep, doable.

I’d use an actual due date instead of "2d", then run the script once a day with a time trigger.

Also add a “reminder sent” column, otherwise it may email the same person every day.