0:00 This is the laziest checklist ever. We're going to do some spreadsheet automation here. I don't know why I sent myself This email that says create a checklist that auto checks a checkbox every hour or every ten minutes Okay, I sent myself an email about this video and I'm wondering, can we do this?
0:23 I haven't even tried to attempt this yet. We're going to do that here in this video. That's basically it. Here's a check list.
0:32 We check these off, but can we get the spreadsheet to do it itself? Let's try. We're going to go up to spreadsheet sorry, extensions, app script.
0:43 It's going to create that project for us in real time. Let's see how long this might take us. We're going to do first check function.
0:54 That just checks a checkbox. Where are our checkboxes? I guess we really need to know which checkboxes have been checked.
1:03 So it's B2 to B9. Let's call this variable checkboxes to check. I'm going to do spreadsheet app dot get active spread, get active spreadsheet.
1:18 Add those parentheses because autofocus. Fill doesn't do that. It autocompletes the name but doesn't autocomplete the parentheses. Let's get a range.
1:27 Because we're lazy we're just going to hardcode this. B2 to B9 to B9. But you know what, I forgot to get.
1:37 Get sheet by name. I think we just said sheet one. I don't think we've renamed the sheet yet. Now, dot get range.
1:45 Get values. Okay. We have values now in our checkboxes to check. Now we're going to go through each one and see.
1:53 We're going to do a for loop here for i equals zero. I is less than checkboxes to check.length. See how many are in there.
2:06 And we're going to just run this loop through all of them. A plus plus. And now what are we going to do for this loop?
2:13 We just want to know, I guess, we only want to check the first one that's not checked. So if we're going to go into and grab this again, if, get range, don't know if we want this, if range is going to be row.
2:43 I plus 2, and then the column is going to be 2. We only need 1. Dot. Is checked. Okay. So, this is going to be weird.
3:05 So basically this is saying is it checked or not? And if it is checked, we want to, We'll just keep going through the loop.
3:17 If it's not checked else, we want to check it and then be done. So we're going to add a break here, I think.
3:27 I think we need a break here. We're going to see what happens. So if it's checked, do nothing. Just go back through the loop.
3:40 But if it's not checked oh wait, I guess we can do an if not. So if not checked, do this.
3:50 We'll do that instead. We'll put a not. The exclamation point puts a not there. But we want to check it.
3:57 If it's unchecked, dot check. I think that's it. But it might go through everything. So if it's checked, break, hmmm, how do we break it?
4:16 Let me think about this for a minute. Let's see if we add a break here, if this works. It might check off everything.
4:23 Let's just try it. We're gonna command s, save this. It's gonna take a minute. The first time we save, always takes like a minute.
4:29 Let's run it, see if we get any errors we might need to authorize. Yeah, review our permissions. Sure. Gimme that sweet, sweet automation, right?
4:42 Nope. Alright, let's run it again. It only checked once. There we go. Okay, that's it. That's all we had to do.
4:50 I thought we had to do something else. But now we want to do this every hour. So what we can do is run this check.
5:00 Let's go triggers, add trigger. We're going to choose our check one. We're going to do a time driven. We want minutes timer and we want every, wait, is it actually our timer?
5:18 Our timer. Our timer every hour. Save. Done. Alright, that's the laziest checklist ever. So now, we will come back to this and basically, literally, that trigger is just going to go over to your editor, go find check, run check and click on it. Click this, every hour.
5:40 Click. And then, we're going to go back and check. Yup, third one's checked. And every hour, it's going to check.
5:47 This is the laziest checklist ever. We create a checklist, run this automation, and we're done with our jobs, right? Our checklists are checked.
5:55 Done. I hope you enjoyed this one. Bye.