Apps Script to Send Email with Values Based on Number Value

52 views
Skip to first unread message

Frayda Zirkind

unread,
May 29, 2026, 1:24:10 PM (5 days ago) May 29
to Google Apps Script Community
Hi, 


I am trying to make a Google Apps Script that does the following:

When the value in cell K3 is less than or equal to 2, search through the whole sheet to find false (unchecked) check boxes and of those false check boxes, find the earliest date in the column preceding the check boxes. 

Then, I want an email to be sent to me with the following information: the date (of the preceding column of the false check boxes; e.g. 6/4/2026), the text in Column B of the row that has that earliest date (e.g. Microsoft), and the URL of the hyperlink that's in that cell in Column B (e.g. microsoft.com). 

I've tried to make a Script to do this but have been getting stuck. Any help would be greatly appreciated. 

Thank you in advance!

Michael O'Shaughnessy

unread,
May 31, 2026, 4:20:35 PM (3 days ago) May 31
to google-apps-sc...@googlegroups.com
Well I took a stab at this!!

I wrote some scripts (with Gemini's help) that you may find useful.  Here is a "force copy" link to the spreadsheet:

It has scripts accessible from a menu that you can experiment with.  It also has an onEdit trigger for emailing, but I set it to use K3.  YOU may have to install the trigger.  If you run into issues let me know and I can help you set it up.

At least this will give you something to work with!



--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/98b6bdc7-00b9-45c5-80d8-b1cb33949d13n%40googlegroups.com.

Frayda Zirkind

unread,
Jun 1, 2026, 1:49:13 PM (2 days ago) Jun 1
to Google Apps Script Community
This script is awesome! Thank you!!

I adapted the message (body) of the email notification to what I would like the email to say, and I am wondering if there is any way to include the URL of the hyperlink in the cell that ${result.name} returns. In other words, when I test the email notification in the menu bundle that you made, the email says that Facebook is the first one unchecked and the date unchecked by Facebook (5/17/2026). Is there any way for the email to also include facebook.com, which is the URL of the hyperlink of the cell that says Facebook?

Michael O'Shaughnessy

unread,
Jun 1, 2026, 8:11:13 PM (2 days ago) Jun 1
to google-apps-sc...@googlegroups.com
Well of course there is!!  😁

Now to do so we have to switch from a "plain text" email to an HTML email.  Not to worry, it is pretty straightforward.

So I updated the original sheet I shared to include 2 more scripts:

findEarliestUncheckedDateWurl()
This is just like the other one, but it now includes getting the company URL.

testEmailNotificationWurl()
This is also just like the other email test BUT it sends an HTML message.

I suggest getting another copy of my updated sheet and reviewing the changes.  So you don't have to search, here is the link:

You just might want to rename this copy with URL in the title somewhere.   

Let me know if you have any questions or run into any issues.  I would be more than happy to help.

Frayda Zirkind

unread,
Jun 2, 2026, 8:11:23 AM (21 hours ago) Jun 2
to Google Apps Script Community
Thank you again!!
I combined the onEditScript with the testEmailWurl and installed a trigger for every morning at midnight so that every day, when K3 updates, it checks if K3 has a "2" value and if so, send me an email. 
I'm very grateful for all your help!

Michael O'Shaughnessy

unread,
Jun 2, 2026, 7:06:52 PM (11 hours ago) Jun 2
to google-apps-sc...@googlegroups.com
It was my pleasure!!

I enjoyed working through this!

Let me know if you need anything else!

Reply all
Reply to author
Forward
0 new messages