Google Drive is an excellent tool for storing and organizing files, but creating multiple sub-folders manually can be time-consuming, especially for large projects. Thankfully, there are ways to automate this process. In this guide, we’ll walk you through how to create multiple sub-folders in Google Drive automatically using Google Apps Script, complete with screenshots.
Step 1: Access Google Apps Script
1. Open Google Drive:
- Go to Google Drive.
- Click on the “New” button on the left-hand side and select “Google Sheets” from the dropdown menu.
2. Open Apps Script Editor:
- In your new Google Sheet, click on
Extensions
in the menu bar. - Select
Apps Script
from the dropdown.
Step 2: Write the Script
3. Create the Script:
- In the Apps Script editor, delete any code that is already there.
- Copy and paste the following script:
- Replace
'YOUR_PARENT_FOLDER_ID'
with the ID of the parent folder where you want to create the subfolders. You can get this ID from the URL of the folder.
4. Save and Run the Script:
- Click on the disk icon to save your script. Name it something meaningful, like CreateSubFolders.
- Click on the run icon (a triangle) to execute the script.
Step 3: Authorize the Script
5. Grant Permissions:
- The first time you run the script, you will need to authorize it to access your Google Drive.
- Click on the “Review Permissions” button, select your Google account, and click on “Allow“.
Step 4: Verify the Sub-Folders
6. Check Your Google Drive:
- Go back to your Google Drive and open the parent folder.
- You should now see the sub-folders created as specified in the script.
Customizing the Script
7. Add More Sub-folders:
- To create more sub-folders, simply add their names to the
subfolders
array in the script.
8. Dynamic Folder Names:
- You can also generate folder names dynamically based on other criteria, such as dates or user input.
Conclusion
Using Google Apps Script to create multiple sub-folders in Google Drive automatically can save you a significant amount of time and effort. This method is especially useful for organizing large projects or managing repetitive tasks. With just a few lines of code, you can automate your workflow and enhance your productivity.
By following the steps outlined in this guide, you can easily set up your Google Drive to create sub-folders automatically, ensuring that your files are always well-organized and easy to find. Happy organizing!
Share Your Views: