Send a Button from Google Sheets in an Email

About this Tutorial

quick fun video to show you how to add a button to emails when you send emails from Google Sheets.

Video Transcript

0:00 Do you want to send a button in an email from a Google sheet? Just like this. This is an actual email that I've sent to myself and this is a button.
0:09 This actually works. It's a link to YouTube. Let me show you how to use this or how to implement this.
0:17 So, in our Google sheet, all I have is in B1, I have some text and in B2, I have the URL that I want to send.
0:24 And that button too. So, let's go to an extensions app script. Now, here I've created a function send email. And I'm just sending it to myself.
0:39 This is just me as the owner of the spreadsheet or whoever is the owner. You can replace this with text, email address, anything.
0:47 The subject is just, the word button. The URL, we're grabbing from spreadsheet app that get active spreadsheet, that get sheet by name.
0:54 Sheet one. So, you can say any sheet name there. Get range B two. And B one here for the text.
1:03 Now, here's where the magic happens. We're going to create a variable called HTML body. This is in, not just single quotes.
1:11 Boats. But actually, back ticks. So, this back tick on a Mac is just under the escape button, in the upper left corner on a, And why we're doing this is so that we can fill in the URL with just this dollar sign, and curly brackets, and, And this URL variable, this is called interpolation.
1:40 And here's all the magic, we're creating an, A with an Href style. It's gonna be background, color. We have text decoration, none, padding.
1:51 Uh, you can increase this or decrease it as you wish. We have a margin as well, and a border radius, so that you have that rounded corners.
2:00 We display, In block font family, you can change this if you want, you can even change the font size. And I added a little border bottom here, four pixels, and solid, and here's the color.
2:11 This is just a slightly different color than the color of the background here, this red. And then, we're using Gmail app, send email, we're sending it to the owner, or whatever.
2:24 Whatever. Or email address you want. We're sending a subject, just some text. The text body here is just a fallback.
2:30 Uh, I wrote this email, or sorry, this URL, and added the URL. Uh, it's a fallback if who you're sending to doesn't accept HTML emails.
2:42 But then we're putting in curly brackets, an option, which is HTML body with a capital B. Cold. And then the variable that we've called HTML body.
2:53 That is all we're doing here. If you want to see more, I have more and better sheets about sending emails and automating that from App Script.
3:05 And if you're not watching this on bettersheets.co, become a member today because down below, you get access to this sheet and this exact- exact.
3:13 Script. Over on bettersheets.co, every tutorial comes with every sheet.