How to Hide Rows Marked Complete in Google Sheets
Learn how to automatically hide rows marked as 'Complete' in Google Sheets using Google Apps Script. This tutorial walks you through the process step-by-step, ensuring your task list stays organized.
So every single time I mark Complete, I want this row to be hidden or hide the row. When Mark complete, let's go up to Extensions app script . We will rename the project. And we'll rename the function on edit. Now, this is a built in simple function trigger that we can put an event here, but we're gonna use the variable E. This could be any word to get us some interesting information, like row equals e do range , do get row and column equals E range dot column. You might have different types of tabs here. So we'll call this tab tasks and we'll make sure to only execute edits on this particular tab. So we need to know the sheet as well. So variable sheet is equal to spreadsheet app.
Do get active spreadsheet , get active sheet . Get name. This is gonna get us the name. Now, if an in parentheses we're gonna say Ro is greater than one. Meaning we have everything that's not the header . If we want to edit the header , we wanna do that without having to, uh, do anything. Uh, emper, Sam. Ampersand call is equal to one. Now, this makes sure that the range we're getting, anytime we do an edit, that it's in the first column or the A column ampersand sheet is equal to now it's two equal signs. Remember, tasks in quotes. Now, once all of those things are true, we need to also make sure we have the correct value. Value is equal to complete. Okay, that's this complete, actually, it's not all caps.
We need to make sure we're getting that in our variables. Value equals e dot value. It's super simple with this on edit function . Now, inside of all of this, if May, may, basically, if all of these things are true, we're gonna execute something. We're gonna say spreadsheet , app dot, get active spreadsheet . That's the entire file. Get sheet by name. I think this is all caps, tasks get range , and our range is gonna be the row we're on the, actually, we don't even need to get the range . We just need to hide a row and whatever row we're on, we're getting that from this edit. So we just hide the row. That is it. Let's go over and mark this complete. We see we're getting error. The exception is that the number doesn't match the method Signature. We do need to get range here. We need to get the row and the column.
But all of this we need to copy into a variable range equals this range , and then put it inside of this high row. Let's mark off this website design as complete, and now it's hidden . And each time we complete a task, even this first one, hit complete again. It's going to hide all of the rows that we mark as complete. If you want this app script , it's down in the de description below. You are watching better sheets here on YouTube. Make sure you check out this video or this video and subscribe right now to get more tips, tricks, how tos, get more out of your Google sheets than you ever have before. I'm excited to be making a ton more videos here. Ask me questions down in the comments and I will answer them in future videos.
But for right now, right here, one of these videos is gonna be your next Google sheet.