Syntax for Hyperlink in Google Sheets to send and email based on cell values

647 views
Skip to first unread message

mark yates

unread,
Jun 24, 2020, 7:47:10 PM6/24/20
to Google Apps Script Community
Hi,

I'm trying to insert a hyperlink into a Google Sheet to send an email with a subject line and body based on cell values.  I have two named ranges (EmailSubject and EmailBody) that contain the message I want to display in the Subject Line and the email Body but I can't figure out the syntax to combine the two.  I can create the link to send the email with just the subject line or just the body but not both.  

What is the syntax to combine both the subject line message as well as the body message?  Below is what I have but receive an #ERROR!.:

=HYPERLINK("mailto:m...@myemail.com?subject=Status Change " &EmailSubject&?body=EmailBody)

Thanks

Craig Pearce

unread,
Jun 24, 2020, 9:38:43 PM6/24/20
to google-apps-sc...@googlegroups.com
You need to put ?body= in quotes and make sure to have ampersand before and after. 

Sent from my iPhone

On Jun 24, 2020, at 5:47 PM, mark yates <yatesm...@gmail.com> wrote:


--
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 on the web visit https://groups.google.com/d/msgid/google-apps-script-community/aacf833b-c91a-471d-907a-0e5a42286156o%40googlegroups.com.

Martin Hawksey

unread,
Jun 25, 2020, 1:49:21 AM6/25/20
to google-apps-sc...@googlegroups.com
Not tested but this should work:

=HYPERLINK("mailto:m...@myemail.com?subject=Status Change " &EmailSubject&"&body="&EmailBody)


mark yates

unread,
Jun 25, 2020, 4:30:49 AM6/25/20
to google-apps-sc...@googlegroups.com

Michael Ellis

unread,
Jun 25, 2020, 9:28:12 AM6/25/20
to Google Apps Script Community
Martin,
I've been following this thread with interest.   Do you know how to grab a cell value which contains a date and populate it into the subject line or the body of the text in the generated email?   I realize this should be easy, but I can't seem to stumble on the right combination of functions.   I just keep getting the date from my cell represented as a number.
Thanks
Mike

Martin Molloy

unread,
Jun 25, 2020, 9:54:19 AM6/25/20
to google-apps-sc...@googlegroups.com
Hi Michael

have you used the text function so something like =Text(A1,"mm/dd/yy")


Michael Ellis

unread,
Jun 25, 2020, 12:47:42 PM6/25/20
to google-apps-sc...@googlegroups.com
Wow, I'm dumb today.

Thanks!

Michael G. Ellis



You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/Rbafjjowld4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAO8s2PjFmVYBBUNPR7Ke4Fgj1b%2BLp%2BZz8gtJP9GnS0BvH7yKYQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages