0:00 So you want to move a tab over to the left or the right and you don't want to do it manually, which I've shown in a really quick video how to literally click and drag this sheet around.
0:13 We can reorder these sheets physically, manually, but gosh, it takes a long time if you have a lot of tabs.
0:20 So how do we get this sheet one or this active tab to actually move over to the far right without having to click and drag it?
0:27 I'm going to show you in Extensions, Apps Script. It's a very simple thing. It's three lines. You can copy it from this video.
0:34 If you are a member of BetterSheets, you can get this sheet down below. If you're watching this on YouTube, become a BetterSheets member today.
0:42 So here's function. Move tab to far right. We can name this anything we want. We're going to use a constant SS just to say get the entire spreadsheet file.
0:50 And all we need to know is how many total sheets there are. So this is SS, which is SpreadsheetApp.getActiveSpreadsheet.getSheets.length, getting how many tabs are there.
1:02 And then we're going to use one line, which is SS.moveActiveSheet. And we're going to set an integer. And this is a specific number.
1:09 Which place do you want it? Do you want it number one, number two, number three? In this case, the total number of tabs or sheets inside of our spreadsheet file is the place that we want it.
1:20 So in this case, it's going to be number 51. So if I run this and I go back, you can see sheet one is now in the 51st place.
1:30 That's pretty awesome. But we can make this far, far easier to use. You don't have to just come to this function, hit run in here.
1:37 We can make it far easier to use, especially if you have other users trying to use this. We're going to go to bettersheets.co slash snippets.
1:51 And we're going to get this custom function. It's going to give us two functions that are going to be available in our sheet.
1:57 And I'll show you that really quickly. We're I'm just copying and pasting it from better sheets. We're going to call this custom menu.
2:03 We are going to use function move tab to far right as the first item. We're going to rename this move to right.
2:13 We'll say far right. And the second item we will name, we want to do another one called move to far left.
2:20 But we will create that in a second. Save this and go back to our sheet and refresh it and you'll see something is different.
2:29 And you'll see in the help column, we have a custom menu and we have move to far right, move to far left.
2:34 So let's test this out. Let's take the sheet one, move it back over a little bit. And without having to go to Apps Script, we can move to far right.
2:43 There it is. But let's make the far left one as well. Go to Apps Script. This one's even easier to make.
2:50 We're going to copy this function move tab to far right. We're going to call this far left. We're also going to make sure it's available in our menu up here.
3:03 And we do not need to know how many sheets are in our spreadsheet file. We just need to move it to position one.
3:10 That's it. So that's the far left is position one. So let's close this, refresh our tab so that that custom menu refreshes again, loads up, and we have moved to far left, moved to far right.
3:24 Let's click move far left. So now it is in position 1, and we can move this, as much as we want back and forth, back and forth.
3:33 We can move this daily, weekly, hourly, minute by minute. This is really cool. So now you can move your tab to either end very, very easily.
3:42 And you can do any active one. Let's do number one, move to far left. Oh, it's already in the far left, far right.
3:50 There it is. Number one. And if we want to move it back to the far left, that's number one. There you go.
3:56 So again, if you are a BetterSheets member, down below is a link to this particular video. There's a spreadsheet file, and you can get this Apps Script.
4:03 If you're not a member, just copy the script, and go check out bettersheets.co slash snippets for more Apps Script you can use in your sheet.