How to Create Multiple Sub-folders in Google Drive Automatically

How to automatically create multiple sub-folders in Google Drive for each student and their subjects using Google Sheets and Document Studio.

A teacher would like to create separate Google Drive folders for each student in her class. Within each student’s folder, there will be additional subfolders for various subjects. This folder structure would make it easier for students to submit their assignments to the appropriate subject subfolders.

Students' data in Google Sheets

We’ve prepared a Google Sheet with the names of students, and the subjects they are taking. For example, consider a student named Emily Johnson, who is taking Maths, Science, and English. In this case, you need to create four new folders in total, with one main folder named ‘Emily Johnson’ and three subfolders within it for each subject: Maths, Science, and English.

Create Multiple Folders in Google Drive

Install the Document Studio add-on for Google Sheets. Open the spreadsheet with the student data and click on Extensions > Document Studio > Open to launch the add-on.

Create a new workflow inside Document studio, give it a descriptive name like Student Folders. Next, select the source worksheet that contains the student’s data and click on the Continue button to move to the next step.

Google Drive Task

On the next screen, you can specify the conditions for creating the folders in Google Drive. For instance, you may only want to create folders for students who are taking a specific subject or are in a particular class. Press the Continue button to move to the next step.

Choose the Google Drive task and then select Create Folder from the dropdown menu. Next, select the parent folder in Google Drive where the student folders should be created. You can choose to create folders inside your personal Google Drive or even Shared Drives.

Google Drive Folders

Naming Folders and SubfoldersStudent Folders

Now that you have selected the parent folder, you need to define the name of the child folder along with its subfolder structure.

For the Subfolder Name field, we’ll put {{ Full Name }} / {{ Subject 1 }} and this will do two things:

  1. Create a new folder for each student in the parent folder with the student’s name. The folder is only created if it doesn’t already exist.

  2. Inside the student folder, create a subfolder for Subject 1 that the student is taking. The value of Subject 1 is replaced with the actual subject name from the Google Sheet.

Subject Folders

You may also put the {{Email Address}} column in the Editors field to share the student folders with their email addresses automatically when the folder is created in Google Drive.

Create Additional Subject Subfolders

Now that you have defined the task to create subfolders for the first subject, you can add more tasks to create subfolders for other subjects as well.

Instead of creating a new task, you can simply duplicate the existing task and change the Subfolder Name field to {{ Full Name }} / {{ Subject 2 }} to create subfolders for the remaining subjects.

Create Subject Folders

Now that workflow is ready, choose the Save and Run option to create the folders and subfolders in Google Drive. The folders would be created and a link to the folder would be placed in the spreadsheet itself. If a folder already exists, the link to the existing folder is placed in the spreadsheet.

This is how the folder structure would look like in Google Drive:

Create Drive Folder Structure

Also see: Create Folders for Google Form responses

Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

0

Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.