0:00 <affirmative>. Hey, so in this video we're gonna email yourself a cell from a Google sheet every single day. What we're gonna do is we have one sheet, one cell, a one, we have some data in here, let's call it 55, right?
0:14 And we want to email that now, no matter what happens to get that data into the sheet. We're not covering in this video, but in this video we're covering
how to get that data from the sheet into your inbox.
0:27 So email yourself every day. This is probably the most coolest, most powerful little thing that is simple to do. So follow along.
0:36 We don't have much to cover, but it's gonna be a little complicated. All right. First off, we are in sheet.new.
0:44 We have created a brand new sheet and here's our data. We have sheet one is the sheet. We have a one is the cell.
0:51 Now, again, no matter how we get that data in there, if it's progress, if it's someone else updating, if it's updated, like summed up every day, no matter what, that's not part of this video.
1:02 What we're gonna do is we're gonna first go to Extensions app script. Okay? Now, in app script, we gotta wait a moment for it to load here.
1:12 We're gonna create a function called email me every day. And in that function, we want to do one thing, male app.
1:22 This is an in a builtin function inside of Google Sheets and Google Script, we're gonna do dot. And here we have a autofill or auto Complete.
1:33 It's a send email. Now what we want is we need three parts to send. We have a recipient, someone we're sending to subject Body.
1:46 So we want a subject of the email and a body. Now for our program to work and our, our email to work, we need to put the variables recipient, subject, and body above it.
1:59 So we're gonna say variable recipient equals, and we're, I'm just gonna put my own email address. Now you can put your own email address.
2:07 You can actually put anyone's email address here, but put your own email address right here. Variable, R E c recipient, we've just called that r e c for short.
2:17 So we don't have to, I don't have to admit that. I don't know how to spell recipient. I don't know if it's I before E or E after I, I don't know.
2:24 But recipient, r e is my own email address. And our subject is going to be just today's data. Today's data.
2:36 Now I want to, one weird thing about Google or Gmail and getting email is that anytime you get an email, especially from the same user that has the same exact subject, it will thread it.
2:48 But I don't want these threaded. I want a new email in my inbox every single time. So what I'm gonna do is I'm gonna add a plus, and this is gonna concatenate that's gonna push together these two things.
2:57 And the other thing I'm gonna have is date this new and a capital D date with parentheses. This is a timestamp.
3:04 This makes sure that every single time this email is sent, it has a, in the subject, a completely different subject.
3:10 Today's data from this on this day and I'm actually gonna put that as the little delineator here. Okay, the last thing we need is the actual data.
3:22 That's pretty easy too. We're gonna type in variable body, cuz that's the, the variable right here that we need. And what we need here is the data.
3:31 So what we're gonna do is start on the entire spreadsheet file. How do we get that? That's Capital S spreadsheet app.
3:40 So just like mail app is a builtin function for emailing from Google Sheets. Spreadsheet app is a builtin function to access spreadsheets, which is what we're doing in Google Sheets right now.
3:51 And what we want to do is wanna get active spreadsheet. We wanna put parentheses after it. And notice there they, you can auto autofill it and auto complete it.
4:01 It's trying to help you out. So we're gonna get sheet by name. We're gonna put parenthesis and the sheet we want is sheet one.
4:10 So we just put that there. And now we do get range. Cuz inside of the sheet we have all these rows and all these cells, we need to say a one here.
4:21 So we won't get range in quotes. We're gonna put a one for the A one cell. Now we can, now we're accessing the cell, but we actually need the data inside the cell.
4:31 And in Google App script, this is called a value. So we get value and put the parentheses there. And that is it.
4:38 Okay, we're gonna save a command S we can also click up here and save project. So what we've done here, let me review this.
4:45 We have done this one. Line code mail, app dot send email. We have a recipient who we're sending it to a subject of what that subject email will be in the body, what's inside the email.
4:55 We just want the value. We just want the value of send me whatever's in that cell. We can hit command s or hate Hit save project here.
5:04 Now, to run this, once I run this, because I use spreadsheet app and mail app, these are built in functions, it's gonna ask me for permission.
5:14 So I'll see up here, we say email me every day. That's the function we write here. We can run this from here and I will right now do that.
5:21 So hit run. It's gonna ask me for authorization. Once it starts running, There it is. Authorization, required review, permissions. These permissions are very basic.
5:36 We just have to select our own Google account that we are using. If you have multiple Google accounts already logged in you have to select the correct one that you wanna run it from.
5:45 And see here the two things that we added. Mail app and spreadsheet app, spreadsheet app, see, edit, create, and delete all your Google Sheets spreadsheets.
5:53 That's what we want to give permission and send email as you, that's the mail app. So we want to allow, this might take a moment or even less moments if you are on good wifi.
6:04 All right, did we email it? We need a hit run again and I'm gonna go check my inbox and here we go.
6:12 We have a sent email. It is today's data with the whole timestamp and the number 55 that is right here.
6:20 I'm gonna change this to 45 just in case anymore. We, we send that email anymore. You see that it changed.
6:26 Okay, so that is it. What I mean is that, is it for creating this script? Now how do we send this every single day?
6:36 How do we make sure we don't, we don't wanna come in here and hit run every single day. We could have, we could be checking the spreadsheet that way.
6:44 But what we actually want to do is inside of Google App script over here on the left side, there's five options here.
6:50 We're gonna click on triggers. I'm gonna move my head out of the way a little bit. Down here at the bottom right, we have ad trigger.
6:58 We're gonna click that. Once we have now a mod and a bunch of options, we're gonna choose which function to run, which is email me every day, which deployment should run.
7:08 Yes, head Select event source. This is where you must change it from spreadsheet to time driven. Once you do that, you have some options.
7:16 We're gonna do Daytimer. And Daytimer allows us to pick which hour of the day we want to send. So right now, I wanna send it between 2:00 PM and 3:00 PM maybe, you know, depending on if you wanna do a report at the end of the day after 5:00 PM five to six, or six to seven to give 'em a little headway.
7:34 Or if you wanna send this data maybe the night before the night of and you want to get it in the morning, maybe send it the hour before you check your email like six to 7:00 AM What happens is, let me tell you what goes on here.
7:48 When we select this hour, we cannot send a specific time each day just like Aron job kind of in programming.
7:56 We can't do that. What we have to do is select an hour. Now what's gonna happen is Google servers will send it at one point, randomly within that hour, the first time it runs, but then every single time it runs after that, it will be 24 hours later.
8:11 So it will send between six and 7:00 AM the same time whenever it does choose. And we're gonna hit save. And once we've done that, it will show up here as a trigger.
8:23 We can always delete this. If, say you want to change the time you can edit it. You can also send it maybe at different different intervals.
8:31 Maybe you only wanna send it once a week or you wanna send it twice a day. If you wanna send it twice a day, then you have to have two time driven.
8:40 And you can send it at like 6:00 AM and 6:00 PM right? Two different triggers doing the exact same script. So that's pretty powerful.
8:49 Way to email yourself a cell of data every single day. Hope, hope you enjoyed this video. You can copy this if, if you're a member and watching this, I'll have a link to the sheet down in the down underneath the video.
9:08 Thanks for watching. Bye.