Automatically Uncheck A Daily Checklist

About this Tutorial

Create an automatic unchecker for a daily checklist. Fun way to learn Apps Script and simple Google Sheets automation.

Video Transcript

0:00 I made a really quick video, ended up on TikTok, that checking these things daily, we wanted to create a daily unchecker, so we wanted to create a automatic trigger automatic script that can trigger automatically to uncheck these, and this is what I ended up with over here on the editor but I wanted 
0:19 to do this one other way and I wanted to show you, BetterSheet members, how to do this one more way because I think it's much more interesting so let me explain this in a hot second and then we will get to what I think is a much more interesting and fruitful sort of function so again this function does
0:39 work we check off some things may not check everything off but when we run this uncheck function as it is everything gets unchecked or actually what it does is it gets set to false and what we've done here is we have a range b1 to b11 we've hardcoded our range we've created a false array an array of 
1:00 falses and we've set the values this is possible this is totally sort of ok but again im gonna show you a better way if youve never done any appscript before this is called a function and then we are going over to triggers and we are setting a trigger to do this daily in order to do this daily we create
1:22 a time driven trigger choose the function uncheck we choose day timer choose an hour and within that hour it will happen and we can save it and we can delete it if we want but our appscript can be a little bit better this was done very quickly because essentially we have this variable which is the active
1:40 spreadsheet the whole file the entire file we're in right now we called it daily to get the this variable daily to get the sheet name daily then we got the range to uncheck which is daily docket range and we're just hard coding b1 to b11 and then were using the javascript function or appscript function
1:58 here set values actually this is not javascript this is appscript completely set values this is an array of arrays because it is a vertical list so its essentially saying this false is like the first item in the first row the first item in the second row and it is a vertical list of array I sort of made
2:22 it visually the same but lets do this a different way lets keep this actually lets change this range we don't necessarily need to have this b1 to b11 we can make this a little more interesting by using the row column or r1 c1 notation our first row is going to be 1 our first column is going to be 2 for
2:47 b our number of rows is going to be how many rows do we have here 11 thats cool 11 the number of columns one.
2:58 And that's our range and instead of set values we're going to create a for loop so for we want i equals zero zero we want a semicolon i is less than eleven which is our max i plus plus this is our for loop that says start at zero keep going until this is no longer true which is zero.
3:31 Eleven so i is under eleven as long as i is under eleven keep going and every time you run through this iteration add one to i so what is the iteration the iteration is going to be range to to uncheck dot set actually un check so this actually we need a different range here sorry actually yeah we don't
3:56 even need this up here ok this is great this is variable range to uncheck we are going to use 1 and we are going to use i plus 1 yeah and thats it and then range to uncheck uncheck okay thats actually much simpler than i even thought okay so lets see if this actually works we have to check some things
4:26 we are going to click run see if we get any errors hopefully we did this and its fine lets actually check everything off okay thats everything and lets just double check that its getting all of the rows unchecked so click run looks like its doing fine and we go back to our sheet and its doing fine lets
4:50 see if we can quickly run this and go back and there it is there its going through the whole thing thats it that for loop even though the for loop is a little bit complicated to learn and i would recommend watching another video here on better sheets which is is the errors that happen getting overcoming
5:09 those errors uhm that for loop makes it so much sort of programmatically simpler so that we dont even need to know how big this range is we can always edit it with this just this here, this 11 can even be a variable that says take in all of the rows, get the entire range we can expand this programmatically
5:34 much better than if we hardcoded b1 to b11 and we added those falses we set them to false we used a actual function dot uncheck instead of set values i think this is much more elegant and much more more nicer but it also comes with a lot of baggage right you have to know the for loop you have to know
5:54 that uncheck actually exists instead of just setting a false or true and i say all the time that check boxes are literally a visual representation of true or false so setting true or setting false is totally fine but there's this other way to do it as well again just different and maybe a little bit 
6:13 more elegant i hope this is helpful to you learning app script

Courses

Spreadsheet Automation 101: Introduction to Pre-course Videos

Breaking Through Errors In Apps Script

Think Like a Programmer: Develop The Mindset of an Apps Script Coder

Tips to Navigating Thousands of Lines of Code In Apps Script

Spreadsheet Automation 101: Functions

Spreadsheet Automation 101: Variables

Spreadsheet Automation 101: Dot Notation

Spreadsheet Automation 101: Camel Case

Spreadsheet Automation 101: Parentheses

Spreadsheet Automation 101 Lesson 1: GetValue - Introduction to SpreadsheetApp

Spreadsheet Automation 101 Lesson 1: Spreadsheet Taxonomy

Spreadsheet Automation 101 Lesson 1: A1 Notation vs Row,Column Syntax

Spreadsheet Automation 101 Lesson 1: getActiveSpreadsheet() vs getActiveSheet()

Spreadsheet Automation 101 Lesson 1: onOpen() Trigger - Custom Menu

This Seems Like Automation

Spreadsheet Automation 101 Lesson 2: Get Values - Introduction

Spreadsheet Automation 101 Lesson 2: Arrays

Spreadsheet Automation 101 Lesson 2: For Loop

Spreadsheet Automation 101 Lesson 2: Bracket Notation

Spreadsheet Automation 101 Lesson 2: Logger.log()

Spreadsheet Automation 101 Lesson 2: If ( ){ } and Checkboxes

Spreadsheet Automation 101 Lesson 2: onEdit() Trigger

Introduction to Spreadsheet Automation 101 Lesson 3

Spreadsheet Automation 101 Lesson 3: MailApp

Spreadsheet Automation 101 Lesson 3: Email Yourself For Loop

Spreadsheet Automation 101 Lesson 3: Send Email Every Week Trigger

Spreadsheet Automation 101 Lesson 3: Email Other People For Loop

Spreadsheet Automation 101 Lesson 4: Access APIs Introduction

Spreadsheet Automation 101 Lesson 4: UrlFetchApp

Spreadsheet Automation 101 Lesson 4: OmdbAPI get ApiKey, get Data in URL

Spreadsheet Automation 101 Lesson 4: OmdbAPI get data in Apps Script

Spreadsheet Automation 101 Lesson 4: JSON (beautifier) and OmdbAPI parameters

Spreadsheet Automation 101 Lesson 4: OmdbAPI Parameter Picker

Automatically Clear Content | Refresh Reuse Recycle Templates

Automate Google Sheets With Zero Experience

Automatically Uncheck A Daily Checklist

Activate A Certain Sheet When Opening a Spreadsheet

Scoping Functions in Apps Script