How to Create a Google Folder in Folder in a Google Drive in Apps Script

Learn how to create nested folders in Google Drive using Google Apps Script, directly from your Google Sheets. This tutorial walks you through the process of automating folder creation with dynamic names sourced from your spreadsheet.

So I'm gonna show you very quickly how to create a Google folder inside a Google folder. We're gonna create a folder from our Google sheet, and then inside that folder we're going to create another folder. Actually, we're gonna create two so you can see that. So we're gonna go to extensions app script . Here we have just any old function . We'll call Create folder structure. We're gonna use Drive App. This is a Capital D, capital A Drive app. This is a function that exists within App Script that we can just use right away, and we will have to give it permission later. But for right now, let's just do Create folder, big folder. Now, if we just did this in our route drive, we would create a folder called Big Folder. But we want to create more folders inside of it. So we'll call this variable big equals, and then we'll do big dot create folder.

And we will create a little folder inside that. So big dot create folder, another folder. Now these are the names here that we have here, and if we did just this exactly like this, it'd be great, right? We creating a folder, creating a little folder, another folder inside that big folder. But I want to take. The names perhaps from our Google sheet. So variable big folder equals spreadsheet . App dot, get active spreadsheet , get sheet by name in quotes, sheet one, get range B two, get value. This is gonna be the name of it. We'll replace that variable here, so whatever here in B one, actually, sorry. We'll fix that B one. We'll copy this a couple more times and create new

variables. Little folder and another folder. And it's is gonna be B two. This'll be B three. And instead of this text here, we'll use our Google sheet. Now, after this is written, I will click run. I might have to add permissions, select all . Continue. We're in Google Drive now and we see that we have a folder called Big Folder, and inside that we have little folder and another folder. Now, if we wanted to create these folders with different names, all we have to do is go to this settings here and. Edit this text. This is really cool. If you're setting up folders for other people and you want those folders created in their drive, whoever's running this automation, we can go to better sheet slash snippets and get this unopened function as well, which is gonna add a full menu to our sheet

so we can call this create folders. And we can say the first item is create folders. We don't even need a second item. We don't need this as well. And once we save this, we can exit and refresh our sheet. And up here next to help, we have a button called Create folder. So we can just select this. We can create this sheet for someone, or add this script to someone's sheet that they're already using. Hey, I need to create these folders, say every week or every month or every day and just button to create some Google folders in their Google folders. 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.