Tuesday 4 May 2021

Bulk create Google Drive folders with a sub-folder

The following Google Apps Script is designed to bulk create Google Drive folders along with a sub-folder from data given in a Google Sheet (eg to name the folders and add permissions).

This tool and blog post is largely a continuation of this one for bulk creating Google Drive folders. The main difference being that there is an extra column to provide the name of your sub-folder. Note that the tool will try to create a sub-folder regardless of what is entered - as I was just aiming to create a version for the many requests I got from the previous blog post from people who wanted a sub-folder.

Use data within a Google Sheet to bulk create Folders and add permissions
Bulk create Google Drive folders from a Sheet of data

Concatenation

Create those useful descriptive folder/file names so items are easier to search for in the future. Concatenate will let you combine values that may exist in different columns in another spreadsheet for example, or take those folder names and prepend/append words around them. Concatenate guide webpage here.


Download

Download the Bulk create Google Drive folders with a sub-folder here. Please use 'File' > 'Make a copy' for your own version.

 

9 comments:

  1. Hi, this script is great but I wonder if is there a way to add multiple folders within a created subfolder? ie.
    First folder/ (Name)
    sub folder 1/ (Order number)
    sub folder 2 + 3 + 4 ... (Items)
    If that makes sense to you.
    Thanks

    ReplyDelete
    Replies
    1. Hi Darren

      Yes there is. This blog post may help slightly with loops and passing Parent IDs: https://www.pbainbridge.co.uk/2020/02/bulk-create-test-foldersfiles-in-google.html

      Kind regards
      Phil

      Delete
  2. Hi Phil – thank you so much for making this script available. I'm still learning how to use Google App scripts – is there an easy way to modify this to create a Google doc instead of a sub-folder inside of each folder?

    ReplyDelete
    Replies
    1. Hi

      Errrm there would be several points in the script that would need tweaking to work with a Google Doc (file) instead of a sub-folder. It would be tricky to pull all of those out accurately here though.

      Hopefully I can find some time in the near future to do something for this.

      Kind regards
      Phil

      Delete
  3. Hi Phil,

    Really appreciate the Folder script and how helpful it has been for me (and everyone else)!

    Would this script be able to copy a selection of existing sub-folders inside a master folder as the "subfolder" within the newly created 'Folder' that this script runs?

    I have a group of sub-folders I routinely copy to new folders and this script helps me create new folders but I still need to copy over a list of sub-folders (and their content) over manually.

    Any help is appreciated!

    ReplyDelete
    Replies
    1. Hi Akbar

      Thank you for the nice feedback.

      It's not really possible to 'copy' a folder in Drive/Apps Script - Google typically expects you to create a new folder as you require it. You would need to use an iterator to go through your source files/folders and create new versions/make copies of them as necessary (example of an iterator here that goes through all files in a folder - Lines 56 to 75: https://www.pbainbridge.co.uk/2019/09/bulk-rename-files-in-google-drive.html)

      Towards the end of this month I'll be releasing a tool for bulk creating single folders and adding any number of files to it - so that may provide you with some further guidance.

      Kind regards
      Phil

      Delete
  4. Thank you for this support. I have looked through several of your posts and am still having trouble creating exactly what I need. Please see my sheet https://docs.google.com/spreadsheets/d/18yEm85y0fXLmyNxjeXJZrG7_gYy1tokqxShvCSzy6ag/edit#gid=0

    I am looking to create a master folder "Master Folder (Grad Profile) that houses an individual folder for each of the students (columns A and B). Within each of the students' folders, I want to have the other sub-folders embedded (columns C-G). Would you be able to help me with this?

    ReplyDelete
    Replies
    1. Hi

      That is something feasible for Apps Script to achieve. You are going into sub-sub-folders however for which I only have this blog post (https://www.pbainbridge.co.uk/2020/02/bulk-create-test-foldersfiles-in-google.html) for bulk creating test folders. It should show you the principle of creating a loop, inside a loop, inside a loop (yes a bit mind-boggling!).

      If you're completely stuck and need a solution, I do Freelance work so could work together with you on this. Just use the Contact Form at the top of this page.

      Kind regards
      Phil

      Delete
    2. I'll see what I can accomplish. Thank you for your help.

      Delete