Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Video Transcript
<div> Hey, sheet checkers. It's Andrew, the big sheeter here. Really fun video we're gonna do right now because it is extending Google Sheets in a really fun way. We're gonna be sending emails. I have had literally two people in the past week and a half ask me for this and I answered their question very specifically, but I wanna generally reach out to everyone here, give everyone the opportunity to learn this.<br><br>It's probably one of the more fun things I've ever done in Google Sheets and really expands Google Sheets and. Really interesting ways.
So we're gonna send an email from Google Sheets. We're gonna actually send an email every day. It's gonna get a little tricky. So what I've done is this might be a longer video than normal because I'm gonna walk through exactly what you would walk through when you're trying to apply this.<br><br>You are more than welcome to grab this. Grab any code that I write here, you're gonna definitely have to change it or you're gonna be sending me emails. Don't do that. So you will wanna change it. Send yourself an email and test it out from your own Gmail. There are email limits.
I won't get into them here.<br><br>I want to get you going. Started on this. Right away. So here's what you might have a use case for this. If you have other people set up, maybe some data Learn about data types and how they affect your Google Sheets. Opens in new tab that they enter every day, and then you have to go and check that Google sheet, but you just have to check like one cell or one couple of columns.<br><br>And you would much rather have that emailed to you. Here's how you do it. So I've set this up. Literally, I have just created a sheet new a new sheet here with sheet new. I have not done any other steps, so this is exactly what you're gonna go through.
In order to send an email, we need to write a script.<br><br>How we find the script is we go to tools script editor Discover how to access and use the script editor in Google Sheets. Opens in new tab . And what we're gonna be doing is we're gonna be sending that that sales number Understand how to work with numbers in Google Sheets. Opens in new tab and also the revenue number Understand how to work with numbers in Google Sheets. Opens in new tab to ourselves. So we would get a usually untitled project. It says Code Es, it says my function Get to know functions and how to use them effectively in Sheets. Opens in new tab here. We won't need this right now. We will, it will ask you later to name it if we wanna save it.<br><br>So let's just name it right now cause. I'll send an email daily. Let's call it, it'll take a moment to save. It always does. Don't worry.
Anytime you have write something new in the code, it'll give you this little red dot that you need to save. Don't worry about that. That doesn't mean you made an error Find out how to troubleshoot common Google Sheets errors. Opens in new tab .<br><br>Just means you need to say it. Okay? So I've already written the code. You can obviously get it once it's in the email, but let's see if it works I'll explain it once I copy and paste it in here. Okay, so this function Get to know functions and how to use them effectively in Sheets. Opens in new tab , I have literally just named it basic email. You can name, this name can be anything you want.<br><br>I recommend naming it something that actually means something that you immediately know.
It's not like some code word or this is a fun function Get to know functions and how to use them effectively in Sheets. Opens in new tab . It will help you later to actually name your functions Explore various functions available in Google Sheets. Opens in new tab by what they do or what they do. So I named this basic email cause we're sending a basic email.<br><br>First thing is, let's go back to this document I have named this tab. With this sheet. Okay. The name of the sheet is sales. Why I say that is because the first thing we do is this spreadsheet Learn what a spreadsheet is and how to navigate it. Opens in new tab app dot get active spreadsheet Understand the concept of the active spreadsheet in Google Sheets. Opens in new tab , dot get sheet by name. And we say sales. It is capitalize S because it is capitalize S here sales.<br><br>And so we're going to that sheet and we're gonna.
Then we're gonna go variable sales, equal sheet dot, get range Learn how to define and use ranges in your Google Sheets. Opens in new tab , C3 get value, which means that it'll go to the sales page, it'll go to c. Three and it'll grab whatever the value is here, which is 45. How you get that number Understand how to work with numbers in Google Sheets. Opens in new tab there? It doesn't matter If this is a function Get to know functions and how to use them effectively in Sheets. Opens in new tab , it'll grab 45.<br><br>If it's a function Get to know functions and how to use them effectively in Sheets. Opens in new tab or an import Discover how to import data into Google Sheets. Opens in new tab range Learn how to define and use ranges in your Google Sheets. Opens in new tab or anything where Learn how to use the WHERE clause in queries. Opens in new tab it's, maybe it's summing five or six different or 12 different sheets, it doesn't matter. It's gonna get the value of this. So right now it's 45. You could combine Find out how to merge cells in Google Sheets. Opens in new tab a bunch of sheets and then get like one number. Bam. You got it.
Then we're gonna grab also the revenue.<br><br>So that's just c4. Same thing. We're gonna however you get this here, if it's some average, whatever it is, how you get it there, it doesn't matter. It's gonna grab the value, which is gonna be 5 6 8 3 0 3 0 8. We will see Based on formatting Explore formatting options to enhance your Google Sheets. Opens in new tab what it sends in a hot second. We're gonna do this real quick.<br><br>And then, so once we have, we know where Learn how to use the WHERE clause in queries. Opens in new tab to go with the sales page, we know what values Understand how to work with values in Google Sheets. Opens in new tab to get. C3, c4. Now literally all we do is do mail app dot, send email, and then parenthesis. And it's gonna get three things.
We need three things in order to send an email from Google Sheets. You need one. Who are you gonna send it to?<br><br>Cuz it's actually the account you have, it's who you're sending it. Two, you need the subject. What is the subject? The second thing here, this comma says daily email. Third, you're gonna write, what are you sending? So what is in this third thing is probably the trickiest. Right now you could literally send just any text message you want as an email, but in this case, what I've done is put these variables, the sales and the revenue.<br><br>This is literally called sales.
This is literally called revenue, and I've put them here. So I says sales, colon, space, sales, whatever is in that. Val that value. Then revenue, whatever is in the range Learn how to define and use ranges in your Google Sheets. Opens in new tab of the, whatever the value is in the range Learn how to define and use ranges in your Google Sheets. Opens in new tab of c4 it's gonna put here. Maybe let's see what happens.<br><br>Okay, so we're gonna first do command S to save and see that red.is gone. And now we're gonna click this play button, which is literally if you hover over, it's called Run. So we'll run. This is going to happen every time. The first. So it won't happen. Sorry. It won't happen every time.
It'll only happen the first time.<br><br>It needs authorization Learn about authorization requirements for scripts in Sheets. Opens in new tab to review permissions. And what does it do? First, we need to make sure we're, we are choosing the account you want to use. So this is the account I want to use. Let's move my face. This may happen, so it's still, it says this app isn't verified. We know we wrote the script. We go advanced and then go to un go to Untitled project.<br><br>Click that and now it'll say Untitled project once to access your Google account. That's it's you are accessing your Google account.
Allow, you might get security messages on in your email or whatever that might happen. Now let's go and see here I got an email and there I got daily email. It says Sales 45, revenue 5 6 0 3 0 8.<br><br>So it didn't format Explore formatting options to enhance your Google Sheets. Opens in new tab the value. It just says 5 6 3. Cool. We got an email sent. That's it. Okay. One more thing. Actually, no, two more things. Sorry. One, we might want to only send an email maybe in case of like maybe we wanna send two different emails.
One, if it's like too low and one if, like you've hit your mark right.<br><br>So we have some kind of if statement, and then second, the third or the third thing we're gonna do in this video is I'm gonna show you how to send this email every single day without fail, and you never have to remember it again until you get the email. Okay. So I wrote the other one here. I have an if, and let's see if this is gonna work.<br><br>And again, you can totally go into this sheet, go into this document and copy it your.
We're gonna go command s save, and now I have a function Get to know functions and how to use them effectively in Sheets. Opens in new tab that says if email, that, that's just me naming it. Now, I said if the only thing it added is this, if function Get to know functions and how to use them effectively in Sheets. Opens in new tab , if the sales are less than 20, it's gonna send this top one.<br><br>And it says here, it just changes the subject to low sales. Then it, whatever else happens if it's not under. It'll send this other email which says, daily email over 30 sales. Actually should be over 20 sales. 20 plus sales. Let's say that. Okay, so we'll save. Let's run.
Oh, it's gonna run the top one and the second one.<br><br>Let's see what we get in our email and everything.<br><br>Okay, so it did send just the top one. So let's do this. I am going to show you how to we are gonna copy that and we're gonna make a copy here. We're only gonna have the IF email. We're gonna rename this to if email. We're gonna go here, we're gonna delete the if email. And we're gonna rename this to basic email.<br><br>This allows you to run two separate codes, same document, two separate codes. Now I can run, so it says typewriter get range Learn how to define and use ranges in your Google Sheets. Opens in new tab , null get range Learn how to define and use ranges in your Google Sheets. Opens in new tab , null line five.
Ah, I just found my problem. It's a get range Learn how to define and use ranges in your Google Sheets. Opens in new tab null because it's looking for the sheet by name summary here. We need to rename that. So I do command S to save.<br><br>Let's try it again. See what problems we get run into now. Oh, so it should have run. And so if it's correct let's see what it should do. So if it's sales 45, it's above 20, so it should have sent daily email, 20 plus subs, and then sales and revenue. Let's see what it sent. Daily email. 20 plus sales.<br><br>Sales 45 revenue 560,000. Great. Okay, so now let's test under 20. So if it is, let's say it is 15. Okay.
Now, when it runs, let's see what it does. Sent us an email there, low sales, and then it tells us Sales 15, revenue five 60. So now we have an email, a function Get to know functions and how to use them effectively in Sheets. Opens in new tab that can send us an email without fail, right?<br><br>No matter what the number Understand how to work with numbers in Google Sheets. Opens in new tab is in that val, in that one box, it will send us an email. So how, now how do we run this without having to come here, come to this script and run it? This is how we do it. We create a trigger Discover how to set up triggers for automated tasks in Sheets. Opens in new tab and we trigger Discover how to set up triggers for automated tasks in Sheets. Opens in new tab it every. So we're gonna go to edit. This is very hard to find. It is almost always impossible to find edit current projects triggers.<br><br>Okay?
And you're gonna load this up. It's gonna look like this on the very bottom you're gonna click add trigger Discover how to set up triggers for automated tasks in Sheets. Opens in new tab . And now choose which function Get to know functions and how to use them effectively in Sheets. Opens in new tab to run. Obviously it'll be up to you to decide which one you want. You can add number Understand how to work with numbers in Google Sheets. Opens in new tab , a number Understand how to work with numbers in Google Sheets. Opens in new tab of different triggers. Maybe you want to add, a basic one to start off with and then you wanna switch Understand how to use the SWITCH function in Google Sheets. Opens in new tab it out, or you want to add, maybe both of them at different hours in the day.<br><br>But let's do the if emails and that every day deployment is just head, the select Learn how to use the SELECT clause in queries. Opens in new tab event source we want to do at time. And we don't wanna do it every hour.
We wanna do it once a day and then you can choose your time of day. I, this is a completely, what will happen is it will take up to a day to run and then at some point within this hour it will run.<br><br>Usually whenever I've done this before and set this up, usually happens within the first five minutes. What's really cool is that you can get a failure notification. So say you You wanna make sure you get an email.
Every, you wanna make sure you get an email every day, but you wanna be notified any weekly.<br><br>It doesn't really like super matter if you get it unless you don't get it for a week. So you might be able to change this failure notification. I usually leave it at notify me daily. Click save, and then you take a moment and now this will send that email every single day. Or if it doesn't, it'll send me a.<br><br>A failure notification and and that's how you send emails from Google Sheets. Feel free to ask me any questions. This is a really cool function Get to know functions and how to use them effectively in Sheets. Opens in new tab of Google Sheets.
It makes life freely easy sometimes for things that you check Google Sheets for constantly, but you don't have to edit them.<br><br>Once you set it up. Now you can live in your email. More you can, it ends up being email help, but it's a really cool function Get to know functions and how to use them effectively in Sheets. Opens in new tab in the script that you can do. And it's a pretty simple script. More than welcome. If you have any difficulties with this maybe you have a di difficulty with who you send it to or subject or how to do these variables, please feel free to ask questions about it.<br><br>How to do change this to different things.
This if function Get to know functions and how to use them effectively in Sheets. Opens in new tab sometimes could be very it depends on what you wanna do. Sometimes it's a date, like one of the people, one of the people I helped on in the last couple weeks, they asked for a certain day, like one. And so what you have to do is essentially understand when the, if function Get to know functions and how to use them effectively in Sheets. Opens in new tab is not within that like range Learn how to define and use ranges in your Google Sheets. Opens in new tab that you wanna send of dates.<br><br>Oh, I wanna send this within two days of X. You need to just delete this else function Get to know functions and how to use them effectively in Sheets. Opens in new tab and you. If it's not within this range Learn how to define and use ranges in your Google Sheets. Opens in new tab , then it does nothing. And so you don't get an email until you do.
But literally this will script will run once a day, every day, just do, just end with nothing. But you can test it out by sending yourself an email being like, this is an email to tell you nothing happened.<br><br>So that's a really fun thing you can do to test it out. And yeah, you might run into some problems if you don't give it the permissions you need. And feel free again to ask me any questions. Bye.</div>