Members-only tutorial

Watch the video and get the practice sheet with membership.

See membership options

Brighten Up Your Checklist Automatically

About this Tutorial

Create a cool function that brightens your sheet background from white to some specific color  a little bit each time you check off a to-do item.

Video Transcript

<div>0:00 So in the previous video, I shared with you how to whiten your sheets, meaning bring the text and the background both to white from wherever they are, over the course of, say, some triggered events or some amount of time with triggers.<br>0:15 But in this video, I'm going to show you how to whiten your sheets.

I'm going to share Learn how to share your Google Sheets effectively. Opens in new tab with you another idea, which is you can brighten up your checklist Discover tips for creating and managing checklists in Google Sheets. Opens in new tab and I'm going to change the code in this video so you can see how I edit the code from whiten your checklist Discover tips for creating and managing checklists in Google Sheets. Opens in new tab to brighten up your sheets if you want<br>0:35 to take a white background and just increase the RGB until it's some color and then keep it at that color. How do we do that? Well, the first thing is we have this range Understand how to define and use ranges in your spreadsheets. Opens in new tab of get data range Get insights on working with data ranges in Google Sheets. Opens in new tab .<br>0:42 We actually want to make sure that that's the entire sheet. We don't want just the data range Get insights on working with data ranges in Google Sheets. Opens in new tab .

So I'm going to look at this sheet.<br>0:48 We have a through h and one through 25. We can absolutely hard code that, right? Get range Understand how to define and use ranges in your spreadsheets. Opens in new tab and we're going to start at one comma one, which is one row.<br>1:05 One column one and then how many rows are there? What do we just say? 25. 25 rows and how many columns?<br>1:14 You can see here a number Explore how to handle numbers in your Google Sheets. Opens in new tab of columns. H is going to do this if we forget eight. That's the number Explore how to handle numbers in your Google Sheets. Opens in new tab eight.<br>1:23 And now this is the range Understand how to define and use ranges in your spreadsheets. Opens in new tab that it will work, this app script Dive into Google Apps Script for automating tasks in Sheets. Opens in new tab .

If you are unfamiliar with this app script Dive into Google Apps Script for automating tasks in Sheets. Opens in new tab , I will walk through it very quickly here, but basically it's just going to take all the sheets, the active sheet Find out what the active sheet is and how to work with it. Opens in new tab you're on.<br>1:37 For every single sheet that there is in the spreadsheet Learn the basics of Google Sheets and its features. Opens in new tab file, it will look at the range Understand how to define and use ranges in your spreadsheets. Opens in new tab . In our case, we only have one sheet, so I'm setting the range Understand how to define and use ranges in your spreadsheets. Opens in new tab to this one sheet.<br>1:47 We can also programmatically look, do max columns, max rows, which we might do later. We're going to get the values Understand how to manipulate values in your spreadsheets. Opens in new tab .<br>1:55 We're going for each of the values Understand how to manipulate values in your spreadsheets. Opens in new tab .

We're going to go to the cell and get the row in the column and get the background color Discover how to change background colors in Google Sheets. Opens in new tab , and then we're going to morph that background color Discover how to change background colors in Google Sheets. Opens in new tab in RGB, then we're going to set the background to whatever that morph is.<br>2:09 For us, we have a we know we're setting it at white, 255, for all red, green, and blue. But we want to get to a point where Learn about using query where clauses in Google Sheets. Opens in new tab it's at some color and then it'll stay that color.<br>2:25 Let's pick a color now. I'm actually going to pick sort Get tips on sorting data effectively in Google Sheets. Opens in new tab of a, sort Get tips on sorting data effectively in Google Sheets. Opens in new tab of a random color. Let's pick this yellow.<br>2:31 And when let's look at it, we're going to hit this custom color.

The R is 251, so we want 251.<br>2:38 We want 188 for green. And four for blue. And what we're doing here is math.max, meaning if we go through we get the RGB of the existing color, then we're going to minus some number Explore how to handle numbers in your Google Sheets. Opens in new tab .<br>2:56 We don't want to do minus one. We did before because we wanted to very slowly over time make the changes, but we want actually these changes to happen relatively quickly.<br>3:06 We're going to do 10x, so minus 10. So if it's 255 then it's going to go down to 250.

245, and it's going to then compare 4 to 255 and get the max.<br>3:20 This math.max just looks at these two numbers and grabs the maximum. That means that if we get to 251, 188, and 4, and we try to minus 10 it will always pick 251, 188, and 4 if it's under each of those.<br>3:37 So let's save this and actually run this a little bit. So, just to double check that it is correct. It is working okay.<br>3:48 Let's go up and just change, brighten background and click run. See if we get any errors. We do have to review permissions.<br>3:58 We will have to review permissions.

Let's go through that process every single time. Not every single time, sorry. The first time you run this code, I just created this code.<br>4:08 All right, it is brightening. And there it goes. It's going through every single cell, brightening it up by 10 each RGB.<br>4:16 Let it, let's let it work. Okay, that's done. But I don't really want to be coming in here and clicking run every single time and now it's going to do it again.<br>4:25 I don't really want to do that. I want to have it actually be triggered when I do an edit on this A column.<br>4:33 So let's look at what we can do.

Here, while that's running, let's do function Explore functions in Google Sheets and how to use them. Opens in new tab on edit and we're going to run Brighton background.<br>4:48 So we're going to run when there's an edit, but we don't want that edit.

To be anything, we want variable sheet equals this event dot source dot, and so what I did is I got the active sheet Find out what the active sheet is and how to work with it. Opens in new tab , e dot source dot get active sheet Find out what the active sheet is and how to work with it. Opens in new tab , got the sheet name Learn how to manage and reference sheet names in Sheets. Opens in new tab active sheet Find out what the active sheet is and how to work with it. Opens in new tab dot get name, and then I got the column number Explore how to handle numbers in your Google Sheets. Opens in new tab <br>5:13 of whatever the edit is, this event, this e is an event, and I said if the sheet name Learn how to manage and reference sheet names in Sheets. Opens in new tab is equal to sheet one, which you can change if your sheet name Learn how to manage and reference sheet names in Sheets. Opens in new tab is different, and the column is equal to one.<br>5:23 Then brighten background, so we're only going to be brightening the background when and if we edit this a column, so let me Click here, and I think it'll just start right away.<br>5:34 Just brightening up the entire page cell by cell by cell, one cell at a time.

We can actually try to quickly do this to see if this top one is going to go past that yellow.<br>5:50 Let's, we might need to do even more than ten at a time to get it. That fast, let's see. So each one is just going and yeah, it's going to stop right at that orange and not go any further.<br>6:06 I don't know if you can tell the top one is not changing, but every time this trigger Understand triggers and how to automate tasks in Google Sheets. Opens in new tab is trying. Triggered it's going to stop.<br>6:12 They'll all want to go through it. So we have this sort Get tips on sorting data effectively in Google Sheets. Opens in new tab of shading, which is pretty cool.

If you do your checklist Discover tips for creating and managing checklists in Google Sheets. Opens in new tab pretty fast, it's going to look like this.<br>6:18 But if you do your checklist Discover tips for creating and managing checklists in Google Sheets. Opens in new tab pretty slow, it's going to look all orange all the time. I hope you enjoyed this.<br>6:24 Brighten up your sheets. If you're a Google sheet, if you're a Google sheet user. You should be brightening up your sheets.<br>6:30 If you're a Better Sheets member, you can get this sheet for free at BetterSheets.co</div>