Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Apps Script APIs used
Apps Script methods used
Video Transcript
<div>0:00 I'm going to share Learn how to share your Google Sheets effectively with others. Opens in new tab with you one line of code that solves one small problem that is very much a usability issue if you are sharing Learn how to share your Google Sheets effectively with others. Opens in new tab your sheet with others uh either selling it or giving it away or even just sharing Learn how to share your Google Sheets effectively with others. Opens in new tab it with colleagues uh so in this sheet I created a sheet that automatically has a GID of<br>0:20 zero. Now what is GID? I'll tell you that in a second. And whenever we create a new sheet, we get a new GID.<br>0:26 Again, I'll share Learn how to share your Google Sheets effectively with others. Opens in new tab with you what GID is.
And there's a page here called Start, but this Start is not GID.<br>0:32 It is not the first page of my sheet, but I want to have everyone start here. And I'm going to show you that script, but first I'm going to explain what GID is.<br>0:48 Sheet.new, if you go there or create a sheet any other way in your Google Drive, you'll see up in the URL that it has the ID of the entire spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab file, and then it has edit hyphen, or sorry, edit hashtag GID equals zero.<br>1:04 This is the very first ah sheet or tab inside of your entire spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab file.
Every time we click new tab, here we have sheet 5, this is the fifth sheet, we are gonna get a new GID, so up here in the URL bar you can see GID equals 1273159016, it's very different than zero.<br>1:25 And it's not two, it's not like it's gonna go iterate up 1, 2, 3, it's gonna be a random number Explore how numbers are used and formatted in Google Sheets. Opens in new tab and every time we create a new tab you're gonna get a new GID.<br>1:33 This is an incredibly useful URL because we're gonna share Learn how to share your Google Sheets effectively with others. Opens in new tab it can, you can do with this is you can share Learn how to share your Google Sheets effectively with others. Opens in new tab this entire URL with someone who has access Find out who has access to your Google Sheets and manage permissions. Opens in new tab to the sheet, either editor Discover the capabilities of an editor in Google Sheets. Opens in new tab or view access Learn about view access and what viewers can do in Google Sheets. Opens in new tab or even if you share Learn how to share your Google Sheets effectively with others. Opens in new tab with anyone in the world.<br>1:46 If you share Learn how to share your Google Sheets effectively with others. Opens in new tab this URL with the GID involved, you can share in it.
Uh, we're going to copy that. I'm actually going to open an incognito window and go to that page and now I am on sheet six.<br>2:01 But if I do GID equals zero, I'm going to be on zero down here. You can probably see it a little bit here.<br>2:11 But what if we want to create a new sheet and call it start here and have everybody start here? This is a problem because if we share Learn how to share your Google Sheets effectively with others. Opens in new tab even the URL, the base URL with anyone, where Understand how to use the query where clause in Google Sheets. Opens in new tab will we start?<br>2:23 We'll start at the very first tab in the sheet.
This is very problematic if you want people to start on the start tab and it's not the very first tab.<br>2:33 Now, you're probably saying, hey, why don't you just make the start tab the very first tab? Totally fine. But sometimes people want to start here and then go somewhere else and have at the very beginning something else.<br>2:46 You may want that. So I'm going to share Learn how to share your Google Sheets effectively with others. Opens in new tab with you how to activate, and that's a key term here, activate the start tab whenever we open a sheet.<br>2:54 And it's one line of code. And it looks like this.
It's function Get to know functions in Google Sheets and how to use them. Opens in new tab on open, which is a, it's a simple trigger Learn about simple triggers and how they automate tasks in Sheets. Opens in new tab that we just type in on open, and it's going to be spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab app dot get active spreadsheet Understand what an active spreadsheet is in Google Sheets. Opens in new tab dot get sheet by name.<br>3:10 We're going to use a start name. That is it. So I'm going to command s. Now, anytime that this sheet opens, and I have access to this app script Explore Google Apps Script and how it enhances Google Sheets. Opens in new tab , without having to actually access the app script Explore Google Apps Script and how it enhances Google Sheets. Opens in new tab , I can go to that start page.<br>3:24 It'll, will automatically do it. So let's go here.
Actually, I will start on GID equals zero, create a new tab, uh sorry, open in a new tab.<br>3:35 And now, it's going to automatically activate to the start tab, no matter where Understand how to use the query where clause in Google Sheets. Opens in new tab I land. So even if I use GID, this 127, create a new tab, go to the sheet, I'm opening the spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab , and it's going to activate that, dot activate.<br>3:50 There it goes. It's going to always bring me to the start here tab. So, this is pretty cool, right?
We're using function Get to know functions in Google Sheets and how to use them. Opens in new tab on open, if you haven't ever used this before, you may.<br>4:02 It may look like this, it might go, it might look like this whenever you go up to extensions Apps Script Learn how to access Apps Script through the Extensions menu. Opens in new tab .<br>4:10 Okay, and I'm going to show you how, show you how to find this.
So, on any sheet whatsoever, you can go up to extensions Apps Script Learn how to access Apps Script through the Extensions menu. Opens in new tab , open it up, and it's going to have at least some blank function Get to know functions in Google Sheets and how to use them. Opens in new tab here, function Get to know functions in Google Sheets and how to use them. Opens in new tab my function Get to know functions in Google Sheets and how to use them. Opens in new tab .<br>4:22 What we're going to have to do, uh, in order to use the open trigger Discover different types of triggers in Google Sheets and their uses. Opens in new tab without having to install any triggers, we just type this in, take my function Get to know functions in Google Sheets and how to use them. Opens in new tab and type in open trigger Discover different types of triggers in Google Sheets and their uses. Opens in new tab .<br>4:32 On, and then a capital O-P-E-N, open.
And in here, we're going to do spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab , and once we have the capital S, so if we just do, actually it even shows up autocomplete there, but capital S, spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab , and spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab app.<br>4:50 Then we're going to do a dot, and anytime after this, we have to put in parentheses.
So we're going to do get active spreadsheet Understand what an active spreadsheet is in Google Sheets. Opens in new tab , that's what it looks like, you can type it, or you can use the autofill Understand how to use autofill to save time in Google Sheets. Opens in new tab to find it.<br>5:02 We have to add at the end here, parentheses, and then another dot, get sheet by name, and inside the parentheses we're going to name the tab.<br>5:14 Again this is the exact name here, if you have a space at the end you have to put the space here.<br>5:18 If you don't have any spaces, you have to put the exact text that you got here in between the quotation marks here.<br>5:26 And the final thing we have to do here is dot activate.
And then end with parentheses.
Hit command S or there's a little b- disc up here you can click save project and now you have the function Get to know functions in Google Sheets and how to use them. Opens in new tab on open which anytime the spreadsheet Understand the basics of Google Sheets and its functionalities. Opens in new tab will be opened it will go here.<br>5:44 I will tell you there is one caveat is that the person must have access to the sheet either as a viewer Learn about the viewer role and its limitations in Google Sheets. Opens in new tab or as an editor Discover the capabilities of an editor in Google Sheets. Opens in new tab .<br>5:52 If it is non-logged in user then Google Sheets has this protective layer that basically says we are not going to execute any JavaScript or any of this app script Explore Google Apps Script and how it enhances Google Sheets. Opens in new tab unless we know who is doing it.<br>6:03 umm this helps prevent malicious sheets from doing things.
things that that we don't want them to do uh and helps spread the helps negate the spread of malicious code.<br>6:16 And so you'll find that if you open this in an incognito window and you're not logged in it won't work.<br>6:23 uh but. That is just something we have to deal with. So you're sharing Learn how to share your Google Sheets effectively with others. Opens in new tab the sheet with someone you may want to uh actually have logged in.<br>6:31 Make sure they're logged in. That was the big caveat here. But I want to give you some more extra stuff here to automate your sheets and automate this particular uh.<br>6:40 Line of code. We've written this line of code.
You haven't working in your sheet. It- it absolutely works whenever we open any tab.<br>6:49 Let's go and check it again. So we're just opening the tab and we are gonna get reader and we're to be or activate the sheet that we want.<br>6:58 But let's say we're somewhere else. Like we're here and we don't know where Understand how to use the query where clause in Google Sheets. Opens in new tab the start tab is. Maybe we have hundreds of tabs.<br>7:04 Dozens of tabs here and we want to go to a specific tab. I'm gonna show you one more thing we can do.<br>7:10 We can add an on open menu.
And we can google for that and I'm just gonna copy the code from google itself.<br>7:18 It's right here function Get to know functions in Google Sheets and how to use them. Opens in new tab on open. Make sure we can, we don't need this function Get to know functions in Google Sheets and how to use them. Opens in new tab on open. We do need this very- variable ui equals spreadsheetapp Explore the SpreadsheetApp class in Google Apps Script. Opens in new tab .getui.<br>7:30 We can delete this comment Learn how to add and manage comments in Google Sheets. Opens in new tab and I'm gonna rename this menu go to start. And then I'm gonna add add an item here.<br>7:45 I'm gonna delete everything else except that add.ui. The first item is I'm gonna say go to start. And we're gonna name a function Get to know functions in Google Sheets and how to use them. Opens in new tab here.<br>7:56 We're gonna actually take this. I'm gonna also add it here. Function Get to know functions in Google Sheets and how to use them. Opens in new tab , go start.
And use the exact same code. But this go start, we're gonna add to this menu item.<br>8:11 And so whenever we click on go start in our menu, it'll actually go to the start. So let's say give this.<br>8:16 Again, we have to do command S or save. I'm gonna close this and I'm gonna refresh this so that it opens again.<br>8:24 And we can even take this, go here, check it if it's gonna do it. It's gonna stay the same.
Alright, we're gonna go to our start.<br>8:31 But now we- We have this extra, I don't know if you can see over here next to help, we have an extra menu.<br>8:37 If we click that, we have go to start. So if I'm on zero, click go to start, go to start.<br>8:43 It's gonna run a script. It will need authorization Understand the authorization process for running scripts in Sheets. Opens in new tab the very first time you run it. But we will authorize it here with a few clicks and we don't have to do this every single time.<br>8:52 But let's go to start again. Go to start. We're gonna activate that. So now we have a way to navigate.<br>8:58 No matter where Understand how to use the query where clause in Google Sheets. Opens in new tab this tab is.
We have it available in this list but again maybe there's dozens and dozens of tabs.<br>9:04 And we know we wanna go to the start tab. And so we have this extra menu up here and a custom menu Discover how to create custom menus in Google Sheets for better navigation. Opens in new tab .<br>9:11 I hope this is very helpful for you to add a little bit of automation and a little bit of cool navigation to your sheet.<br>9:17 And activate a certain sheet whenever you,</div>
Courses
Spreadsheet Automation 101: Introduction to Pre-course Videos
Think Like a Programmer: Develop The Mindset of an Apps Script Coder
How To Change Date Format Automatically
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
Breaking Through Errors In Apps Script
VAR vs CONST vs CONSTANT in Apps Script