Hide Sheet Custom Function

Learn how to create custom functions in Google Sheets to hide and show specific sheets using Apps Script. This tutorial walks you through the process of adding a custom menu for easy navigation.

So you wanna hide your sheet. Now I have a sheet, a template that I created. I have exercises on an about page, but at some point we want this about page to hide and we want the user to be able to hide it. Now, this everyday edge is a completely free template that I created so that you can create a template , go check it out at better sheets to coast slash everyday edge. Literally, it is a workout directory, but I didn't make it. To actually tell you workouts, 'cause I don't know workouts. I just made it because I know Google Sheets, but I'm creating this workout menu in the past video. I've said go to a random row. Now I'm gonna add hide the about. So let's go to Extensions app script . This is our existing app script. Now we have a menu that is created on open and we have a function here.

Go to random row. I'm gonna add one more item. Add item. This is hide about and I'm gonna create the function name for it, hide about, and let's go create that function . Function . Hide about parentheses and curly brackets. All we need to do is spreadsheet app, get active spreadsheet , which is the entire spreadsheet, file, get sheet by name, which is going to be about. And that matches this name here on the bottom of the tab. And we're gonna do dot hide sheet. And that's it. We do have to add the parentheses at the end. Let me show you that. That's at the end. Make sure you add those parentheses. And I'm gonna do command S, or I'm gonna hit this save button next to run. To get the custom menu function. If you haven't yet, go to better sheets.com/snippets,

S-N-I-P-P-E-P-S, and you can copy and paste this exact code so that you can add a custom menu to your sheet. Let's save this. And now to see it in our workout menu, we need to refresh our sheet, meaning close our sheet, open it again, or refresh. Click the refresh button up at the top. Next to extensions help, accessibility is our workup menu. And now we're gonna click hide about. If it's the first time you've ever run it, you're going to have to authorize it. But if you've authorized before notice it just worked. Let's create one more function . It's the polar opposite, which is show about add item, show about sheet, let's say. 'cause maybe we wanna be more specific show about is our function . And we're gonna create a new function , function show about parentheses,

curly brackets, and we're going to use the exact same function . I'm gonna copy paste it, but I need to change the hide to do show show sheet and make sure you add these parentheses at the end. Now I'm gonna refresh my sheet up at the top. In our workout menu, we now have show about sheet and I can click that and I can have this about page there. I can also add and activate My thinking is that if somebody's trying to show the sheet, they wanna see it, they wanna actually go to it. So I'm gonna take this exact same code, the about page, not the show sheet . But I'm gonna copy paste it to the next line, and I'm gonna say Activate again. Add the parentheses, save. Now, I'm not adding another item to my custom menu here, so I

don't need to refresh the page. I just need to go here and use it again. I'm gonna hide it first. It's hidden . Now I'm gonna show it. And I'm now on that page. Pretty cool, right? So you can hide these pages and then have a cool little menu here that says, go show me that page, and it opens it and activates it and brings that user right there to that page. Really cool. I think this is really fun automation you can add to your sheets. 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. Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets. GPT in SHEETS Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets. Download Google Sheets