How to move file uploads from Google Forms to specific folders in Google Drive

Learn how to move files uploaded from Google Forms to a specific folder in Google Drive. You can rename the files based on the form responses

Google Forms’ file upload feature lets you receive files from form respondents in your Google Drive. You can add a file upload question to your Google Form to receive PDF assignments from students, job applications, portfolio images from competitors, and more.

While the file upload feature in Google Forms is useful, it has A great limit. For example, when a respondent uploads a file through Google Forms, the file is stored in a specific folder within the form owner’s Google Drive. All uploaded files are saved in the same folder, making it difficult to determine which respondent uploaded which set of files.

Move uploaded files to Google Forms

Document Studio can help you. The add-on can help you organize uploaded files into custom folders as they arrive in your Google Drive through Google Forms. You can move the upload to another folder, or rename the files based on the answers of the respondents in the Google Form. Additionally, you can organize uploaded files into subfolders for convenient access.

Prepare a Google Form

For this example, we have created a Google Form to collect job applications for various positions in our company. Candidates should enter their full name, the position they are applying for, and then upload their resume in PDF format.

By default, all uploaded files will be added to a new parent folder created by Google Forms in your Google Drive. However, you can organize resume files into subfolders and move them to a specific folder based on the position a candidate is applying for. This will help you easily find resumes of candidates who have applied for a specific position.

The uploaded files can be renamed based on the candidate’s name or their email address. This will help you quickly identify specific candidates’ resumes.

Move files to custom folders in Google Drive

Install Docs Studio and open the add-on to your Google Forms. Create and select a new workflow File Uploads Action from the list of available actions.

With Document Studio, you can move uploaded files to another folder, copy files to another folder, or rename files based on form responses. For our example, we will move and rename the uploaded files based on the position the candidate applied for.

Select the file upload question from the list of available questions. Next, choose the parent Google Drive folder where you want to copy or move the uploaded files. You can also choose to save uploaded files to a shared Drive folder, which is not possible with the default Google Forms file upload feature.

for the subfolder path In the input field, provide the full path where you want to save the uploaded files. You can use placeholders like {{Country}} or {{Position}} To dynamically create subfolders based on form responses.

Finally, provide a new name for the uploaded files. For our example, we used {{Name}} Placeholder to rename uploaded files based on candidate name provided in google form.

Save the workflow and your automation is ready. Now, whenever a candidate uploads their resume through their Google Form, the uploaded file will be moved to a custom folder in your Google Drive. The name of the file will also be changed based on the name of the candidate.

Move file uploads with Google Apps Script

If you’re comfortable with Google Apps Scripts, you can also write a custom script that will move uploaded files to a specific folder in Google Drive. The script can be attached to your Google Form and will run automatically when a new form response is submitted.

To get started, go to your Google Drive and create a new folder (or use an existing folder). Open the folder and grab the ID of the folder from the address bar of the browser as shown in the screenshot.

Next, go to your Google Form that accepts file uploads and select Script Editor from the 3-dot menu. Within the script editor, remove all existing code and copy and paste the following snippet. Remember to replace the folder ID in line #1 with the ID of the folder you created in the previous step.

const PARENT_FOLDER_ID = '<>';

const initialize = () => {
  const form = FormApp.getActiveForm();
  ScriptApp.newTrigger('onFormSubmit').forForm(form).onFormSubmit().create();
};

const onFormSubmit = ({ response } = {}) => {
  try {
    
    const files = response
      .getItemResponses()
      
      .filter((itemResponse) => itemResponse.getItem().getType().toString() === 'FILE_UPLOAD')
      .map((itemResponse) => itemResponse.getResponse())
      
      .reduce((a, b) => (...a, ...b), ());

    if (files.length > 0) {
      
      const subfolderName = response.getId();
      const parentFolder = DriveApp.getFolderById(PARENT_FOLDER_ID);
      const subfolder = parentFolder.createFolder(subfolderName);
      files.forEach((fileId) => {
        
        DriveApp.getFileById(fileId).moveTo(subfolder);
      });
    }
  } catch (f) {
    Logger.log(f);
  }
};

Create an OnFormSubmit trigger

Within the script editor, select initialize From the Function drop-down and click Run To create a button OnFormSubmit A trigger for your current Google Form.

This will essentially run apps script code when someone submits a new form entry and upload files to a specific folder in Google Drive.

That’s what happened. Go to your Google Forms and submit a new test entry. You should now see all the uploaded files organized in a custom folder under the parent folder. The custom folder name is the unique response ID that Google Forms automatically assigns to each form submission.

See also:

  1. Change the Google Forms uploads folder
  2. Move Google Forms uploads to a shared drive

Leave a Comment