How To Automatically Hide Tabs If Not Owner of Sheet

Learn how to automatically hide tabs in Google Sheets for users who are not the sheet owner, while displaying a welcome message for the owner. This video provides a step-by-step guide using Google Apps Script.

So I got this message that said, welcome Andrew. It's my name. How did I do this? And it's whenever I open the sheet. In this video I'm gonna show you how to automatically hide tabs if you're not the owner of the sheet. And if you are the owner of the sheet, it'll give you a welcome message. So let's go to Extensions app script and do this. When we're in app script , we need to create only one function called on open, and that's with a capital. O we need to get two user pieces of information. One is one need to know who the user is, so we're gonna get . Session, get active user and we're gonna get the email address of the active user. And we need the owner . And the owner is equal to spreadsheet app dot, get active spreadsheet, get owner, do, get email.

Now, if user is not equal to meaning this. This exclamation point means not equal to, not owner . Then we're gonna do spreadsheet app, get active spreadsheet , get sheet by name. We're gonna say the team tab. We want to hide and hide sheet . But if we are the owner , meaning this is true, we're gonna say else, spreadsheet , app dot, get ui alert, and we're gonna say, good day. Andrew. Welcome to your sheet. Save now. Save all of this and if we close it and refresh our sheet,

it should give us a message. Good day, Andrew. Welcome to your sheet. Now, if I change the user to someone else, it might take a moment to load the app script to execute it, but it will, did you see it? It actually hid the team tab. It's still here. It's still accessible, but it just hides tabs that the person who's not the owner of the sheet might not need to see. right at That moment. Hopefully this was a really helpful video and fun video to add a little interesting user experience to your spreadsheets. 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.