0:00 So if we scroll to the bottom of a sheet, we see this add 1000 rows to the bottom, we can type in a number here, 500, add that many rows.
0:12 But if we scroll to the right, we can't do that with columns. But let's add this functionality with Apps Script.
0:19 So we're just gonna go to add Apps Script, it's up here, extensions, Apps Script. If you are a member you can get this exact sheet down below.
0:28 If you're not a member and you're watching this somewhere else, become a member today. And grab this, this whole function yourself and put it in your sheet.
0:36 So what we're gonna do is gonna go to bettersheets.co slash snippets. We're going to create a snippet on open, a function on open, we just need that.
0:46 And this will create a menu up here for us. We're gonna call this add columns. We're going to add only one item here, which is add columns.
1:00 Our first item, it's actually going to be called add columns, all of a sudden, so function add columns. And what we need to do is get a modal.
1:12 So how do we do that? We're going to add Google Sheets modal app script. We can just get this dialogue here.
1:26 We don't need an alert. We need prompt. Here we go. So here's the show prompt, all of this. Let's put that in here.
1:40 We're just going to copy it from the Google Help. Let's add columns. How many columns? And now we're going to process the user's result.
1:59 We're going to say if the button's okay, we need to get the actual number here. It's going to be text.
2:13 Here's this text. It's going to be the response, so we'll say number of columns. You added number of columns.
2:29 And here, we'll actually add that node. Number of columns. So we need to get the spreadsheet. Spreadsheet dot get active spreadsheet.
2:39 Insert columns after. And now the position is just the number of columns we have, so we'll get the number of columns.
2:49 Max columns, we'll call it. And then how many is going to be whatever the number of columns we entered. Let's get this variable max columns equals spreadsheet app dot get active spreadsheet.
3:10 Actually we need active sheet, I just realized. Whatever the sheet is, get max columns. There, that's the number of columns we have.
3:20 We need to end this parenthesis. And I think, not spreadsheet, but sheet. Let's just double check that this works, ActiveSheet.
3:32 Insert, actually I think we can just insert columns. Ah, we don't want to put it in the exact, we want to put it at the end.
3:43 Definitely insert columns after. Yeah, it'll work. So let's test it out. Delete this, we're going to save all of this.
3:53 Command S, add columns, we'll rename it. All right. Have all of that done. Close these. Refresh our sheet because that unopen won't be triggered unless we open it again.
4:09 Here, add columns, add columns. I think we might have to authorize for the very first time we run this. That might happen.
4:20 Let's allow. How many columns? Let's just enter 10. So we're going to go over here, you added 10. And there they are.
4:32 There, Z is the normal. There's 10 columns. Done and done. So now we have that add columns, add columns. Let's add another 100.
4:42 Okay. You added 100. Wow. We had all those columns. Now, now we have the ability to add more rows. Fantastic.
4:53 That's it. That's how you add columns automatically. Again, if you are a member at bettersheets.co, down below of this video you're watching, it's gonna help.
5:01 You have the sheet, you can copy it, put it in your drive, copy this Apps Script anywhere you want. If you are not a member yet and watching this on YouTube, hopefully you can copy all that code and get it, or become a member.
5:13 It's so easy to become a member, uh, over at bettersheets.co. Bye.