Hey there stranger!

Sign up to get access.

Spreadsheet Automation for Beginners

About this Tutorial

I start off this video with the idea to show beginners how to automate emails in their sheets, and also add a little bit of AI. Then half way through the video I have a question... can I write AI and then email myself everyday? We try to do that. So you get to see me struggle, and log, and debug. It's quite intense.


Learn more Automation: https://bettersheets.co/courses/spreadsheet-automation-101

Get the AI GPT-3.5 and GPT 4 code: https://bettersheets.co/tutorials/upgrade-google-sheets-openai-prompt-to-gpt-4

Better Sheets members can get the code and the sheet in the video below.

Featured Formulas

Video Transcript

 Hey, so this video is for automation wanters people who want to automate their spreadsheets and who have never touched app script before. I'm gonna show you how to start a sheet in with automation. We're gonna do three things. One, we're going to email ourselves a report, some this sort of checklist.

We're also going to email others. Within that, I'll show you how, but then we're gonna use ai. I've created this app script, which looks like gobby goop to you probably. But you can copy and paste it and I'll show you how to edit it. I'll show you how to use AI inside of your sheets right away. And then we're gonna try to answer a question.

Can AI email or can we email AI to ourselves? This is going to be interesting because I don't know the answer. So you're gonna see both something that I do know, which is emailing from a Google sheet, but you'll also see me struggle, just like I have been for the last 10 years, I've been doing app script and automating Google sheets and spreadsheets.

And I have to admit that the frustration never goes away. As you wanna do more and more interesting things as you learn more. Those two things keep going keep the gap alive, the knowledge gap alive. Even as you learn a lot of stuff, you're still gonna wanna do more, and then you're gonna keep learning and learning.

So hopefully this will both show you some interesting stuff you can do in sheets and what you could also maybe not do we'll see. Let's see if we get through it all. So the first thing to do is I got a spreadsheet here that I was making as a little fun, before and after.

Here's your sheets. Here's better sheets. Showing you really cool things to do and this one, I don't know how to show it, so I'm gonna just show you in this video how to do it abs script. So you've never touched abs script before. We're going to spend a lot of time up here in fi up here on the menu row extensions, abs script.

Just click that when you get here. If you do sheet new I don't know if you know this, but sheet new slash one, two or three, depending on which account you have. If you go to app scripts right away. It actually takes a moment to load. This is what you're gonna see. You're gonna see it. You're gonna end up seeing essentially nothing.

Once it loads, you'll see nothing. You'll see here my function, my function. So we're gonna play with that a little bit. This is what you get right away when you start. I've already copied and pasted AI in here. If you want to Add a new code to your sheets. You're gonna hit this plus fi ad file.

You can actually add html to your Google sheets sidebars and cool stuff like that. But we're gonna add a script. We're gonna call this email and see now we have this function, my function, first things first. This orange button over here means we have not saved. So I'm gonna hit command S. We're gonna save this.

And the first thing I wanna do, I want to email myself. I wanna email myself something from here. Basically, I just want to email myself, say this text we can also do a little sort of report. Maybe there's a report in here that summarizes everything. And or actually even better, let's do up here.

Equals count if range E to E, and we're gonna only count the trues. So right now there's 11 that are checked off. But as if maybe I'm, maybe I gave this project to someone else and they're doing, they're checking off stuff and I just want to get a daily email from them. Not from them, but yeah, maybe from them and says, how many things have you done?

And see now we have these eight. Now I have five, so I wanna get this G one emailed to me every day. I don't wanna have to come and check this every day. I don't want it in my inbox right away. So let's do that. Let's send an email report. We can name these functions, anything we want. We usually use Camel case where the first letter is lowercase, and then any words here are capitalized with no spaces.

The first thing we're gonna do is spreadsheet. App, I'm gonna type it all out, but you can see IntelliSense here is helping us. And then I wanna do act get active. And if I hit the down arrow, I can select this, get active spreadsheet. I'm gonna add the parentheses. Once I add one, it adds the second one, but I must add this, it won't work.

I'll show you an error actually later. Get get. Sheet by name. I'm gonna use the IntelliSense to go a little bit faster, but the sheet name is literally going to be whatever this is called, sheet one. In quotes, we have to put it, so sheet one, and then I want to get range. And so as I'm typing this, Theoretically, this is spreadsheet app is a ex existing function inside of app Script that's gonna help us.

We don't have to write a new function. This spreadsheet app is the function we're using and then get active spreadsheet is the entire file. This spreadsheet file we've just created. Get sheet by name gets the sheet. So as we're going down with these dot notation here, separating each one of these, we are going smaller and getting into the place that we really need to get, which is now inside the sheet we want G one.

And what do we want with this range? We want to get value. And so we can ar say this is a variable and this is gonna be our number, actually our tasks. Let's say we use an equal sign to assign this text here tasks, to whatever this value is. So now I could do logger log tasks, and I'm gonna command S and save it.

And now I'm gonna run. I need to authorize the authorization is needed, so we'll go authorize it. And now let's see if it works right off the bat. There it is. Five. So right, this Loger log shows us right here that this is correct, and we can even add a little tasks, a little text here. Use the plus sign to.

Combine these to add these up. Hit command S to save, run it again. We don't have to authorize it each and every time. And now we have tasks five. So this word task, this variable, V A r, variable tasks, this word now represents whatever this function gets, which is going to be here, G one. So I can click on few more there.

Now that's turned to seven if you can see in g one here. And let's go back, run it again. And now we have seven. So that's not the end of the thing. We don't want to just get the value and say there's seven, we want to email it to ourselves. So just like spreadsheet app is a function that is built into app script.

We're gonna' write mail app, another function that's written into app script. We don't have to write that function ourselves. We just use mail app. Capital A, capital M, spreadsheet app is capital S, capital A. Spreadsheet app and mail app. We do not need to use parentheses. That's a little thing that ends up stopping us.

Actually, let me show you a error cuz if we don't use these parentheses, let's save this. And we've tried to run it. We're gonna get type error spreadsheet, AppD, get active spreadsheet sheet by name is not a function. So we know these are functions. We're using IntelliSense, the autofill to type 'em in.

So the one thing it didn't do was add those parentheses for us. So make sure you do that and now we can run it completely fine. So it's just that literally the, just that parentheses that was holding us up. Okay. Let's go back to mail app. If we do mail app dot, we only have two options. If we did spreadsheet, app dot, we have all of these functions.

This IntelliSense helps us write these functions and it helps us know, oh, we don't have much to choose from. We can get a daily remaining quota. I think in our Google workspace has you have a Gmail account, like@gmail.com. It's 300 or 500, and if you have a workspace, I think it's 2,500 is like a quota, a daily quota.

So if you're emailing yourself once a day, you're never gonna hit that quota. But let's see. You might need to check that daily quota sometimes, but where are you gonna use send email. And in send email, we're gonna add that parentheses, we are going to use a pretty simple syntax here. We're going to use recipient subject body so we can actually write these out if we wanted to.

These are just variable names that we are gonna write right now. So variable. Recipient, R e c equals I'm gonna just write my email address here, and if you are watching this and you need to email me and yeah, need to ask me a question, feel free to email me and ask me a question. Our variable subject is going to be today's task done.

No, not today. Just task done. And our body is going to be variable body equals tasks done with colon. And then we're gonna add plus tasks so that we get the number of tasks done.

Hit command S. So I went and opened my email to see if it's gonna run. So now we're gonna hit run. Okay. Review permissions because we added that mail app, so we have to authorize it again. Let's see if it's gonna send. There it is. Tasks done. Seven. No. So one issue here that I want to. Nip in the butt right away is that you are going to run into a threading in email.

So if you're emailing yourself tasks done every day, this email, the next email a day later is gonna be threaded. That's just a Gmail thing. So let's try to unthread it with with a timestamp here. New date. And we might wanna no, we don't wanna format it. We'll just look at it here. We'll hit delete.

And now see we have this different subject every time we run it. It's gonna be a different time, different day. So that's really cool. That's really easy to do. But now how do we automate this? So we've written the script, written the app, script it, it sends every time I click the run, but I definitely don't want to come in here.

Hit the click, click run. So what do we do? Go over to our triggers on the left side, triggers bottom corner, add trigger. We're gonna choose which function to run, which is the email report. We're going to say time driven, select event source. We don't wanna send it every hour. We wanna send it every day. And then we get to select an hour wi in, within which it will send so maybe something like five to 6:00 AM and we hit save.

And now what's gonna happen is this email will be triggered at some random time between those. In that hour, but then every time, hence after that, it will be sent every 24 hours. So you'll get an email every 24 hours. If you wanna delete it, just go over to this three buttons here, come back to these triggers, hit these three buttons, and click delete trigger.

So just in case it fails or you wanna stop it for some reason just hit delete, delete forever, and you can always add that. Again, super simple to come in here. Select email reports, select time driven, select the when you wanna do it. You can do it every minute, every hour, every day, every week, every month.

You have your pick of the litter here. And then hit save if you want. All right. We have automated an email. We have automated an email to ourselves. What if we wanna email others? That's a good question. Thanks for asking. We can just change this recipient to someone else. This is a Google Workspace account that I sent in an email to me, but this is just text.

This is just someone you can send this to your boss, you can send this to your colleagues, you can send it to a bunch of people. You can cc people. There's some great documentation here if you wanna delete this and look at the IntelliSense. We can see this help here. Let's see. We want, I think this one, so we have recipient, subject body, and in here we can also have the two string, a reply to a subject and a body.

But also, let's go back to the first one. I think it showed. If you wanted to CC people, we need to add a little, there it is to, there's a bit of, yeah, we can copy this so you can actually just copy all of this stuff. Write easily away. So let's just copy that. We wanna send two, we can switch our recipient.

We don't need that anymore.

So this is just a little bit of different syntax, but it's going to allow us to do something pretty cool, which is add a cc. We can take our subject, replace it with our variable, so we can use that variable subject anywhere. And then we can have Buddy anywhere we want. So we're gonna actually delete these inline images.

I do believe we want to do that

and just put the body there, but also I think we can cc and let's do some Andrew plus 11 at Better Sheets Co add a comma at the end. Command s Let's see if this runs.

And we got an email and we have a cc. So now you can cc other people. You can add more than one person to this email that's automated, which is pretty cool, which is really awesome. If you have like groups you want to email yourself, you want to email colleagues, you want to email a boss and yourself or boss and coworkers.

Okay, so now that I showed you how to email, I did promise that I was gonna show you how to use ai. Now, this AI script, I wrote this myself, and I have this in a video on better sheets. So if you're not a me member of Better Sheets and you're. If you are watching this@bettersheets.co, just go to just type in AI in the search and find it.

And there's one called Upgrade to GPT four. I wrote this upgrade, so there was a GPT three version of this, and then I upgraded it and changed this to add in the role and this prompt, different style for the api. So check out that video. I'll put a link in the description, but if you're not watching this on Better sheets.co.

If you're watching this somewhere on YouTube or anywhere else, somebody sent you this e email by email or anywhere, just go to better sheets.co. And all members get these sheets, get these scripts, they get 'em for free. Once you sign up as a member, you can be a monthly member, lifetime member.

You get every script, every template, everything for free. So you can always see, watch a video, and then down below there'll be a link to copy that sheet right away or even access it and look at it and see it. For every video that I do, You'll have access to the sheet that's in the video. If you are, remember, so I already wrote this.

We don't have to go back through and do this again. We can just use AI in sheets right away. I have a tab called API key. I put my API key here. If you see it or it's okay, by the time you watch this video, I've already deleted it. But all I did was put it in a one. I literally went to open ai platform, created a new API key, and then put it right in a one.

And so just like you saw with this email, this spreadsheet app dot get active spreadsheet, dot get sheet by name, sheet one, get range, G one, get value that is getting the value of seven. And now over here in our code, the very first line is getting the API key. It's exactly the same syntax, just different sheet API key, different range, which is a one.

And the value that we're getting is the API key and so that we can then use this API key. In our API call and we're just using URL fetch app. Super simple. If you wanna learn much, much more about this, I have spreadsheet automation 1 0 1, which goes way deep into this. I'll provide a link as well to that down below.

Again, better sheet members. Get that for free. Three hour course, walks you all the way through going from spreadsheet app all the way to URL fetch app. And actually you can write, you can basically write this AI script yourself once you get through that. Basically get through that course, but let's use it.

Let's see what magic we can do. I'm gonna add a column to the right here. And all I need to do in order to use this is write equals ai. And then I'm gonna write a prompt. I'm gonna write a prompt that says something like how in quotes, write a blog article title in the style of in. A persuasive style that is about, and then I'm gonna add a space in a quote, and I'm gonna end it there.

I'm gonna hit the ampersand and I'm gonna hit F two. So F two is this signup for better sheets. The text here, but maybe it's like b2. But I'll work on B2 later in a different prompt. But what I'm doing is I'm just com adding this F two text right here. So just like an ab script, we can add combine text, but we use ampersand inside of a formula.

And so I'm gonna hit the end parentheses and hit enter. We'll see what that does. Upgrade your sleep. I don't think sign up for it. Thinks it's a, it thinks write a blog article about Google Sheets. Let's say not write title. Let's say I am writing a blog article. There we go. Unlock the power of Go Signup Now.

Write a writing. Write a short three word title. It's not gonna say three words. It can probably do four or five words. Let's see what it does. Improve your efficiency. Sign up for better sheets. Great. Now if I just copy and paste this F two is gonna change to F three, F four, F five. So I can actually copy.

I'm gonna hit copy. I'm gonna. Pay special formula only and we'll see another one. And I'm gonna do the same. Revolutionize your to-dos. Project management, revolutionize Project management, Google Sheets. These are terrible titles, right? Write a short three word. Let's say, let's not say short. Let's write a.

Persuasive title.

Let's redo this. I don't like this.

Let's see how this is doing. I just wanna get this formatting back

Master your productivity, revolutionize your project management. So we can do pretty cool stuff here, right? Let's do a few more. There we go. But let's go back and do these as well. This is items that I thought okay, garbage data is a problem you have, so I'm gonna write ai, but I wanna do something with our app script.

That's a little bit cool. That I think is one of the coolest things ever. If I go, if I use this function, ai, I'm writing a new function that is a new, a completely new. Formula, there's like over 500 formulas and you have to not be named one of those. But if you go to Better sheets.co/formulas, you will see all the formulas that exist in Google Sheets.

Here you can see every single Google Sheet formula. You can even hit random now and get a random Google Sheet formula, array formula that was random. And learn all about it and see all the tutorials. There's 21 tutorials and better sheets with that. You have to make sure your function name is not one of those 500 plus.

And you can use it. But the cool thing is you can let this a, which this AI one act like a custom function. All you need to do is, oops.

Is write a comment here and add at custom function. If we just add this little text at custom function in this comment right here, when we go back to our cell and type equal ai, it is already here. It's done. We don't have that we don't have that red squiggly line underneath. So I'm writing a blog about.

Better sheets and how awesome learning Google Sheets is how many benefits there are. Specifically, I want to write a title about a title about, for this. Blog that is about overcoming. Then we're gonna add the quote and b2. Let's see if this works. I think this prompt needs a lot of work, but we'll see This AI is like happening.

It works right away. It's giving us more than one suggestion. I want to write. Overcoming. Let's add a little bit. Moreand write one type per persuasive title. Let's see that. You should get it to write one because it can write 10 or 12. From garbage data to gold, unleashing the power of Google Sheets, garbage to gold.

I'd probably shorten that and make it. Like garbage to gold. Unleash the power of Google Sheets, transform messy data, powerful insights. Yeah, this is like getting me off the blank page and it's really good. If I want to write three, let's just see if we can do it all. There we go.

We are doing it. So now this ai oof. This is great, right? Wow. Look at how many. Titles we have Streamline Your Sheets, master Google Sheets to Save Time and Productivity, chaos to Clarity. I love that alliteration. Stop. Str not stop. Strong, stop. Struggling. Unlock them. Simplify. Okay, so not all of 'em are winners, but this is really cool, right?

We have a bunch of title ideas. We have some things here. The question is can we get an email every day? That writes a different prompt. How do we wanna set this up? Maybe we want AI first to give us like 365 topics about Google Sheets, about problems with Google Sheets, and then give us a title in some style or maybe a bunch of styles, and then we want it to email us that reply.

Each and every day we want to take ai, take some texts that we've already written, run a prompt through ai, and then email us. So we already have this email function, email report. We're just emailing these tasks, but let's do something a little different. Let's add another function. We can always add another function underneath function, email, anything.

And we're gonna email, text, and by putting this text. In parentheses we're saying we can insert anything we want in there and we're gonna use the word text as a placeholder. And here we want to take exactly the same thing we did here, copy paste it. But we don't need our tasks. That's not what we're emailing.

We're emailing some AI text today. And then we're gonna have some date, right? The body is going to be text. Whatever that text is, we are going to email ourselves. That's it. And so now we've taken this email function we've written before. We've edited it so that we have a function email, anything that will email this text to us at some particular date and time.

Great. So then we can actually use this inside of our Somewhere else. Somewhere else in this function in these functions, we can write some more code. Maybe this AI is gonna give us some text. It's gonna return text, and this email is going email. Anything is gonna email us any text. So hopefully the idea is if we run one function, email ai, let's do this variable.

Text equals. Ai and we want, let's say

write 10 titles about,

use a plus sign topic. We'll just use that variable topic equals. So let's do this actually getting ahead of myself. This topic is gonna be in this list, so I can keep adding this list if I want to, but I want to have this topic here, and then if it's sent, and then essentially the bottom, the last row that has sent, the next one is gonna be the one that's gonna be we're gonna write s sent in here.

So how do we do this? Let's see. The topic is going to be, Let's do, let's call this topics the sheet, and we're gonna do variable topics equals spreadsheet, app, get active spreadsheet, get sheet by name, topics, just make sure it's capitalized correctly. Yeah, it's all lowercase variable. All topics equals.

Let's do this. Let's just delete all of these rows. So we want a two to a 13, but we don't know if we're gonna add more. So we're gonna say topics dot get range. The row is gonna be two cause we're, we don't care about the first A one. The column is gonna be one. The number of rows is gonna be last row minus one.

We're gonna get last row variable, last row equals topics. Get last row. That's all we need. Get last row. We just need to know what the last row is. And we're gonna get all topics and we're just gonna get all of them there.

So now we have them all in one thing. Actually, we need more than that. We need two columns. Cause we wanna know how many sense there are. We can do that separately. We can say variable cents equals topics dot get range. Let's do exactly the same thing, except instead of column, or, sorry, row two column one, we're doing column two last for minus one, column one.

So this is all of the B column here. And these are gonna be arrays. We just want to know the length of the scent, and essentially we're going to get all topics, a bracket sense plus one. So we're gonna take the length, sense, length, sorry, sense length. The length of this array, however many things are in sent.

We can even log this if you want.

Actually I'm gonna go grab this prompt. I like this one. I think

we're gonna replace it, right? 10. We're gonna replace it here at a. Quote at the end at a quote in the beginning. I'm writing a blog about better sheets and how awesome learning in Google Sheets is, how many benefits there are to learning Google Sheets. This is terrible prompt, but it's it's getting there.

Specifically, I wanna write a title for this blog that is about overcoming topic. So this text up here, this topic is what we want to. Put in here, write, and I want 10 persuasive titles, not title. With every function we need to output something. So we're gonna return text. Now, this function here let's walk through this again, is just taking we're gonna test it out.

We're gonna actually, let's log or dot log text. Now what we should get is the number of sent, which in this case is one, it's on topic sent. We want to then get our text and we also want to write sent, so we're gonna say spreadsheet app dot get active. Actually, nope, we don't need to do all of that.

We just need to do topics. Dot get range is gonna be column row two, no Row one, column two. Sense length plus one is the column number of rows, sorry, number of rows, one column set value sent. So we're setting the value over here. And the B column is sent. Once we get that text and we log it, we're just gonna log it.

So let's see if this is gonna run. We're gonna choose our email ai run it. Let's see what happens. Error message zero. Let's see if that can be fixed. Yeah, this is interesting. We're running into an error here. Invalid request error.

Oh, I think this is, needs to be plus. Oh my God. I, because we copy paste that from somewhere else in the sheet. But in Cript we need to change those app sentence to plus. So let's see if this does. It might take a minute or has to take less than 30 seconds actually in this way. There we go. Ooh, the number of version.

So we can do, again, an error must be at least one line 24 is an error, but we get our text, we get our ai. Sweet. What happened? What was the error? See, sense length.

B column row one. Column two. Sense length is, oh, I think I need to start on row two. There we go. Let's run this again. We're gonna get a different response from ai, but I think we're gonna get this written in sent. Wait for it. Number of rows. In the same number of rows. So is this sense, length? Oh wait, let's go back to, if we wanna look at our executions. Let's look at that error again. It says completed. We can click on it and we can refresh it and see.

Oh, here it's, that was the wrong, failed. Must number nine. So this is email lo line 24. This is Nine is the character. So line 24.

See topics I get range. Is this zero or less than zero?

Oh, I see the problem. Oh, this is so silly. This is not, this is just getting arranged. We need to get values. Oh, that was, I should have looked at those. Get values. I think this will run now 12. Good. Oh, that's actually, this is gonna be wrong. I know what's gonna, okay. Execution completed. We actually got overcoming undefined verified.

Undefined ver. Okay, so the AI is a messed up, but we will fix that in a second. And we have a sense for everything. Okay? This is going to, we gotta fix this. We didn't wanna do everything at once. We only wanted one thing. Let's see what we gotta get. We got all topics, get values. We got this as 12, but we don't want it.

We want all of the ones that say sent. To be honest, I sweat through these things a little bit each time trying to figure it out, but people who work attend the workshops really love seeing all these errors. So hope you're enjoying this. We have a little bit of an error here because not really an error, just our code isn't fully done.

Our length here is 12, but that's not how many scents have been sent. We only have 1 cent B one, so I think what we need to do is write a little four loop I equals zero. I is less than since that length. I plus, which is an iterator. It adds one each time. And if since I is equal, that's two equal signs sent.

Then what we'd want to do is we wanna create a new, a variable cent array equals that We just need to know the number of cents. Cause we don't need sense. We just, oh, it's a, let's call it one if sent array. We'll do, sent,

sent array equals sent array. Plus one. We'll just add one cuz we know that, actually, yeah, we wanna start at row one. Let's just start at row one here as well. Column two, last row minus one is how many rows? Nope, we don't need the minus one anymore. If we're gonna start at the top, we get all the values.

We just wanna know how many are in the scent column and how many cents. So now we do scent array or sent, yeah, sent array length. And then we're going to use that same scent array, do length to get the next topic. Now this should work. So our topic should be garbage data. Let's see if that is true, if that's what we get.

And we should only send, oh, we send add sent plus one. Change this to one row, one column two, whatever the length of that sentence is, plus one. And column one, we set the value dissent. All right, let's see. See if this works this time.

What is null? Number of roses. We least one. We got same undefined, nightmare data master. All right, we got undefined data here. Same issue, similar issue. We can, if we wanna log things, let's just log everything just to make sure we got what we're looking for here. We want, since let's save it and run it.

All right. Perfect. We got our stuff.

I think we need to add that. I think we need all topics since array. I think we need that. Let's try this again. Typer can't read. Undefined. 29. I'll tell Topics. Center rape link. We don't have any. What are we logging here since?

Are we logging? No. I realize now we don't need the array. We need just this count. So we don't need the length of it. We just need the number. We changed that. There we go. We got two. Oh, that works perfectly. Let's see. This AI work now. Conquer chaos. How we can help you manage projects, unmanaged projects.

Let's see which one it did. Oh, it did. Messy data, I think. No project unmanaged. Okay. We're one off, but we are there. We are getting this to create our AI for us on a topic. We have our se sent account here. I changed from sent array length. We need just sent count, but we are one off. Why are we one off?

Because we probably changed something here. We changed this one. Last row is going to be whatever this is 13.

Oh, I don't think we need to add this plus one here anymore. That's cool. All right, so we're almost there. Let's delete these cents as well. But we are there. We're getting, we're I wanna also put the AI into one of these cells just in case we don't end up. Emailing it or something, but we'll see.

So let's do that here. Topics dot get range. We're gonna take this same exact thing, but instead of plus one.

Wait, our send count. Wait. We do want plus one here though. No.

One second. Let's double check this. I wanna do set value text, but we're going to use the third column, but let's run it and see if this is working correctly. Doesn't seem, oh, I, I see why Okay. It is wrong, but let's do this. We got, we can fix this. I see why we added plus one somewhere. We started the scent count should be zero, I think.

Yeah. That's what it is. So let's run it again.

Do you know why it's doing that? We'll see what happens.

Oh, I'm on two. Okay. That's why. But this AI's gonna take 30 to 45 seconds. Let's see. We'll come back. Okay. It just went slow. But let's do this. I'm gonna delete actually all of this stuff. And we're gonna run it again. Try to do it again. There we go. One that looks better, sent one, and here's our return.

Oh, we cut more stuff? Why is it doing it twice?

Okay, this is silly. This is a silly mistake, but we are writing on the first column which we don't need to do. We need to do sent count, whatever the count is that we're sending plus one. And then number of rose is gonna be one. So this just needs to move over here. That's so silly, but a silly mistake.

We did find out. So let's start over again. We want to, let's see, make sure we have some new stuff to have AI think about and test. Hopefully you're seeing a lot of interesting ways to process your code here with Logger to try it, try different things. There we go. We gotta send Conquer for matting. Woes. Oh, we are still one off. Geez, one off. Let's make sure we're right.

So the first, I'll add one. So I think

all topics starts at one row. One. Let's look at this again. Let's see what we logged here.

Got no formatting, woes to no formatting transfer format. It was this formatting not time intensive. Why did I get three and not should have been two. There is something wrong with our code. A hundred percent. Topics get last row. All topics. We're logging all topics. We are logging the sent account.

Maybe that's the issue. It's one.

If it's one plus one zero. It's getting this. Let's try it one more time. Let's see if our theory's right, it'll be one off again.

Garbage data. Yeah, it's one off still. Okay, I think I figured it out. I think it is this crazy thing here, which is an array is, starts at zero. It's hard to explain. Arrays always start at zero. See we have three things there. So this is 0 1, 2. So if we want, if we put two here or three it'll be one over.

Yeah, this is perfectly fine now. This is garbage data. Garbage data. See, now we're perfectly in sync. This one we can actually delete these and double check that. These are correct. You can run this again.

One time intensive should Perfect. Do it again. It's two

conquer formatting. Perfect. So these titles are all for this topic. Wow. And then now what we need to do is we're adding this to our sheet, but we want this emailed to us, right? So at the end here, what we can do is email anything, and we're gonna email this whenever we send this email. We go email anything text, right?

This text is what we want emailed to us. And here, just because we labeled it text, this was a happy accident. But this could be literally any, this could be text and this could be text, doesn't matter. They don't need to be the exact same word here, but let's see if we run this and do we get our email?

Once the AI works, AI text today, here's our AI text. Here's all our text. Yeah, it's formatted pretty poorly, but we can we love this, right? We now have this automation, right? So how do we say. If we write a bunch of topics here and then now we're gonna get emailed ourselves 10 titles every single day.

That's pretty exciting, right? We have broken through all of the errors, logging everything. We are now taking a text here. Throwing into AI and we're emailing to ourselves, how do we trigger this? How do we make this happen every day? I showed you earlier in this video, we go to triggers. We go to add trigger.

We go to choose which triggers to run. We are emailing ai. We are going to do time driven event source. We want to do it every day, and it will run, let's say 5:00 AM to 6:00 AM and now save every day, it'll send me one. Of these, the next one. And all I have to do is make sure I'm ahead of the game here.

I just have to write 365 titles. I can even write a topics. Give me 10 topics, actually, 50 topics that people normally get wrong in Google sheets or they get frustrated with. Let's see what 50 topics looks like. There we go. We got 50 topics. It is a little bit hard to read. Let's see. We can take this equals split.

The text is gonna be just this here eliminator. I think we can split it by a new line. Oh, we need to add, I think a row. Nope. And to transpose.

There we go. There's all of our topics. We needed to add some more lines here.

Let's get rid of that one. So it's better formatted. Now we can take this equals, split this. Eliminator is gonna be that space cause we have some weird thing there. We wanna take the index of that. We wanna take the second row. There we go. Then we just copy paste this all the way down to 50, and now we have ton more topics to unleash on the wild on our AI and get emailed ourselves 10 blog title articles every single day. Wow. This is pretty cool. I hope you enjoyed this again. Better sheet members will get links to videos where all of this code is available.

The AI is in a couple of other videos. The automations are available in spreadsheet automation 1 0 1. If you're not a me member, go check it out today. Spreadsheet automation101@bettersheets.co. It's of course available, also standalone on Udemy. Check it out. So now we're gonna get, be writing a lot of blogs every single day.

New 10 new titles every single day. Bye.