Quick Follow Up Email

Learn how to automate sending follow-up emails directly from Google Sheets using Google Apps Script. This tutorial walks you through setting up the script to send personalized emails based on task assignments.

Let's send a quick follow up email. Here's a bunch of tasks and we have different owners. I'm gonna create a column here that says email, and for me, I'm gonna put in my own email, but you'll be able to see that it's gonna be different emails, like if we have different people owning each of these things. So we'll put an email here. It's gonna show you different emails, and every time I hit follow up in the status column in the A column, I wanna send a quick follow up email without having to leave Google Sheets. So I'm gonna show you how to set this up. Put your cursor over extensions. Go to app script . Now, the first thing we might want to do is. Name this on edit. Have an event E here, and I'm gonna show you how this is wrong. But we're going to use this function and set up the trigger .

Follow along, and you'll see all the steps. Basically, it's going to be Gmail app, send email, and we're gonna need three things. We're gonna need who it's to. We need a subject and a body of that email. So if we have those things. Then that email will send. So let's do variable two is equal to someone, right? It's going to end up being someone@gmail.com or something. We have a subject, which we might want to include the project name or the task description here. So we might say, how's this going? And then add here. The task and the body of the email will be again, just very quick. Hey, just checking on the above task. Okay. So here we have this task name.

We need to get that. We need to get the email address we're sending to. So how do we get that? We're going to use this e or this event here and with this on edit function . And I'm gonna show you another oned function that's going to have exactly the same stuff. So we can code all of this here. We know what row we're on by going E range , get row, we know what column we're on as well. E range . Get column. You know what value the edit is, or the text is changing e value, and we also know what sheet we're on. Spreadsheet app dot, get active spreadsheet , get active sheet , get name. Okay. And now this email that we're sending, we only want to send it when there's certain criteria met. Our edit is not going to be on the header row.

Our edit is gonna be in the first column, and the text we're going to change is to follow up. So let's put all that there. If RO is greater than one, two, ampersands to say, and column is equal to one, meaning is equal to, that's two. Equal signs here, two. Ampersands for and value is equal to follow up another two ampersands and make sure our sheet is tasks. Make sure that's two equal signs there. And we're gonna put curly brackets here and execute something if all of that is true. So let's move all of that text into here. Let's format our document. Let's save it. Now what's gonna happen is it's going to actually give me an error . It's not gonna be able to send this email, but I just wanna test that

all of these variables are correct and we're doing something here. So we're gonna say logger do log. Email would be sent. Okay. Let's make sure our variable sub is here. Subject and subject is the same. We want to get the task. Before we test this, we wanna get the deck task, so logger, log task, and then plus task. So what is the task? It's going to be in the C column or the third column. So we're gonna do variable task equals spreadsheet , app, get active spreadsheet , get active sheet , get range , the row we're in, third column, get value. So that's the task. Let's save all that.

And again. It's not gonna work. It's gonna give us an error , but let's just test out up to this point. Follow up, click on executions. It says failed. I know why it failed, and I'm gonna get you through that failure, but I just want to test that the values are coming through. So we're gonna hit refresh for a few moments. It takes a little bit of time to get our log here. Their email would be sent clean, duplicate contacts. Was that correct? Clean, yes. And I know why it failed. I'm gonna get you through that right now. So we know our email would have sent, it would've been fine, but here's how we fix this. So we're gonna change this function from the simple on edit to send email. This is just a name we call it. You can name it anything you want.

Just make sure you get this function name correct, save it, go over to the left side and click triggers. And on the bottom right click add trigger , choose which function to run here. If you have multiple functions or multiple app scripts here, you'll have to pick your function out. And now event source is gonna be from spreadsheet . Our event type is going to be changed to on edit. Now this sounds like the exact same thing as Unended, but what this does is it gives us more permissions. So we save it and we, we are authorizing it. It's gonna give us much more permissions to actually send those emails when there's an edit. Make sure you have this trigger here. And now I'm gonna click on another one. Draft release announcement.

Follow up. And now I'm checking my email and actually I got an, I got an error here because we got the wrong email. Let's go back and fix that. Let's go back to our code. We don't have to change the trigger . I realize we didn't put our email address here in this too, so we're gonna use the exact same. Code here is variable tasks, but we're gonna call this variable two. So we're gonna replace this two with that. And we need to know which column are we going to get the email address from? It's going to be the E column or number five. So over here on two spreadsheet app dot get active spreadsheet , get active sheet , get range row, and then. Five and we're gonna get the value of whatever that two column is, or whoever that email address is. Let's go and let's do HR systems.

This should go to number 10, so let's follow up. And once we check our. Email. It says Update onboarding checklist . Is that correct? Yes. And it's Andrew plus 10. So that is going to Andrew plus 10. Perfect. So now we know that every email is going to the correct person. It's including the correct task. If you wanna get this app script , check the description down below, or if you wanna be able to write this. On your own with way more information. Check out Master Spreadsheet Automation. It's a course I have over on Udemy. Super fun, super in depth. It's gonna get you going into Google Sheets. Way, way more. Enjoy it. Check it out in the description. You are watching better sheets here on YouTube.

Make sure you check out this video or this video and subscribe right now to get more tips, tricks, how tos, get more out of your Google sheets than you ever have before. I'm excited to be making a ton more videos here. Ask me questions down in the comments and I will answer them in future videos. But for right now, right here, one of these videos is gonna be your next Google sheet.