Tuesday 2 November 2021

Bulk create Google Drive Folders and add Files 2.0

The following Google Apps Script tool was developed to bulk create Google Drive folders with optional files copied in to each one, all from data within a Google Sheet, along with the ability to adjust all folder/file names used.

It is a variation of this Bulk create Google Drive Folders and add Files tool post.

Bulk create Google Drive folders with optional files, from a Google Sheet
Bulk create Google Drive folders with optional files, from a Google Sheet

Key Functionality

  1. Maximum runtime - in order to prevent the tool from reaching the limits imposed by Google you can adjust the number of minutes the tool can run for. Change this in the 'GlobalVariables.gs' file in the Script Editor.
  2. Continue from where it left off - if you have a lot of Google folders and files to handle and the above runtime is reached the tool will complete the current row/folder and prompt you to run it again, without duplicating any folders or files already created.
  3. Popups - as well as the 'Log' sheet the tool displays a direct popup to the user if it encounters a problem.
  4. Full naming control - you have the ability to tweak every single folder and file name that is created by the tool. See the Concatenate section below to understand the true power of this.
  5. Clickable links - created by the tool which means you can navigate directly to the new folders and files directly from the Google Sheet.
  6. Add more files - the tool currently has columns for 10 files to be added to each folder, but you can actually append more as long as you follow the same convention of 2 columns per file (1 file name and 1 file ID). Do this before you run the tool as you cannot add more files to a folder once it has been created.
  7. Add more folders - after running the tool you can either choose to clear all of the data within it (use the 'Reset sheets' option from the 'Admin' menu) and start again or you can simply append further rows/folders and re-run without any duplication (if the 'Folder Link' column is not blank/empty then it will skip that row).

 

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.


Instructions

  1. Follow the instructions on the 'Welcome' sheet to help you setup the tool as you require. You will need to enter the ID of the Google/Shared Drive folder where you want the new folders to be created under. A folder ID is the last part of the Url eg https://drive.google.com/drive/folders/this_bit_is_the_ID.
  2. Next you will need to go to the 'Folders' sheet and provide the names for the folders you want to create (1 row per folder). Leave the 'Folder Link' column empty. Also add the names and IDs of any files you wish to copy into the new folders. A file ID is typically the long string of random letters/numbers of the Url eg for a Google Doc: https://docs.google.com/document/d/this_bit_is_the_ID/edit.
  3. To run the tool either click the 'Start now' button on the 'Welcome' sheet or use the 'Admin' menu and select 'Create folders' (they both achieve the same goal). The first time you run the tool you will need to authorise access to your Google account and then select to run it again.



Download

Bulk create Google Drive Folders and add Files 2.0 download here (please use 'File' > 'Make a copy' for your own version).


11 comments:

  1. just wondering if can add "Email Address(es) for Permissions" function to this template? THX

    ReplyDelete
    Replies
    1. Hi Kai

      In theory 'yes'. I did start work on a version to do that but it became quite comprehensive trying to lay it out in a universal format for people to use. If I ever do complete it then I'll be sure to post it on the blog.

      Kind regards
      Phil

      Delete
  2. I need to create 1 folder under about 100 existing folders. Can I tweak this tool to do that somehow?

    ReplyDelete
    Replies
    1. Hi

      This tool probably isn't suited to try and tweak for that really. I have this post for bulk creating just folders (https://www.pbainbridge.co.uk/2020/06/bulk-create-google-drive-folders-20.html).

      You would however also need to combine it with something like this one for iterating through the existing folders (https://www.pbainbridge.co.uk/2019/01/batch-get-existing-folder-ids-names.html).

      Neither are a 'tweak' per se.

      Kind regards
      Phil

      Delete
  3. I copied a folder called Master which contained a PDF document, a Google spreadsheet and the two associated forms. Your tool created 48 copies of the folder with each properly named for a teacher. I did have an issue though that the forms were not linked to the spreadsheet. As a workaround, I can copy just the spreadsheet and PDF. This way, the forms are copied into the Master folder and are linked to the spreadsheet. Is it possible to achieve this goal without the workaround? Awesome tool either way. Thanks for sharing it.

    ReplyDelete
    Replies
    1. Hi

      Thank you for the nice feedback. I agree that I have encountered that issue you describe with Google Forms and indeed use the workaround. However I do this so infrequently that I have not jumped into the Google Forms API to look at creating surveys that way at this point.

      Kind regards
      Phil

      Delete
  4. Thanks for replying. I just used the workaround, renamed the forms, and moved them to the correct folder. Took a bit of time but still so much faster than manually creating 48 folders and duplicating the files that went into them.

    ReplyDelete
  5. How can I alter the script to bypass the creation of folders/links and just add copies of files to a list of existing folders?

    ReplyDelete
    Replies
    1. Hi Zach

      I'm afraid I do not have a tool that specifically does that - and it would require a bit more than a tweak. If you require something I do Freelance work so you're welcome to get in touch directly (https://www.pbainbridge.co.uk/p/contact-page.html).

      Kind regards
      Phil

      Delete
  6. Hi Phil, I love the tool....so easy to use (even for a learner like me). I was wondering if it is able to be used to create the folder in Dropbox or is it going to require me to manually upload the folders? I am not an expert in scripts etc. Thanks

    ReplyDelete
    Replies
    1. Hi Debbie
      Thank you very much.
      The tool just works in Google Drive.

      Delete