Upload Files to Google Drive from Google Forms - GeeksforGeeks

Upload Files to Google Drive from Google Forms

Last Updated : 02 May, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Google Forms is a free service that lets you create surveys, quizzes, and more. Google Drive is cloud storage for your files. By combining these two, you can easily collect files from respondents.

This article will guide you on uploading files to Google Drive from Google Forms. You’ll learn how to create a form with a file upload question and automatically store the uploaded files in your Drive.

How to Create a Google Form

Step 1: Open Google on your default web browser.

Search for Google on your device’s default web browser. 

IMG-20240419-WA0032

Open Google on your default web browser

Step 2: Open Forms from Google Workspace apps

Click on FORMS from the 9-dot menu bar at the top right corner of the Google homepage.

IMG-20240419-WA0023

Open Forms from Google Workspace apps

Step 3: Open a Blank form and rename it 

Select a blank form from the window and rename it to Upload files to Drive. 

IMG-20240419-WA0024

Select a blank form from the window

IMG-20240419-WA0026

Rename the Blank form

Step 4: Give the untitled question a name

In the box given below, rename the question as needed.

IMG-20240419-WA0025

Give the untitled question a name

Step 5: Add options to the question

By clicking the “add option” or “add other,” you can add various options.

IMG-20240419-WA0035

Add options to the question

Step 6: Click the required symbol    

There is a Required button in the bottom right corner. To make the question required, click Required.

IMG-20240419-WA0027

Click the required symbol

Step 7: Click Add Symbol on the top right corner      

If you are done with your question, click the add symbol in the vertical bar on the right side of the page.

IMG-20240419-WA0029

Click Add Symbol on the top right corner to add questions

How to Add the Upload File Option to the Form?

A new box will appear for your next question. To upload the file in the form, here are the following steps:

Step 1: Select the file upload option and continue

You can see a list of various options after clicking on the multiple-choice option at the top right corner of the box. Click and choose the File Upload option. A new box with permission will be asked; click continue.

IMG-20240419-WA0028

Select the file upload option

IMG-20240419-WA0034

Click on “Continue”

Step 2: Enter the details of the files to be uploaded

Two questions will be asked regarding the file, the size of the file, and the number of files to be uploaded. Choose and continue.

IMG-20240419-WA0031

Enter the details of the files to be uploaded

Step 3: Click the required symbol     

There is a Required button in the bottom right corner. To make the question required, click Required.

IMG-20240419-WA0031

Click the required symbol

Method 1: Create the Apps Script

Step 1: Open the script editor in the form

Three dots are given in the top right corner of the form. Click “More” to open the dialogue box. Select “Script editor” from the options.

IMG-20240419-WA0037

Open the script editor in the form

Step 2: Click the untitled project on the top

Click the untitled project name at the top of the window.Rename the project to “Upload files to Drive”.

IMG-20240419-WA0044

Click the untitled project on the top

IMG-20240419-WA0030

Rename the project

Step 3: Create another file in the Apps Script     

This step is optional, both code sections can be placed in the same script file. If you prefer separation, follow these steps:

  • Click on “File” in the menu bar.
  • Select “New” and then “Script file”.
  • Name the new file “Setup”.

IMG-20240419-WA0033

Create another file in the Apps Script

IMG-20240419-WA0040

Name the file Setup.

Step 4: Replace the last content with the given one

Replace the content of both script files with the following content:

// Replace “Form Name” with the ID of your form.

var form = FormApp.openById(‘YOUR_FORM_ID’);

var folderId = ‘YOUR_FOLDER_ID’; // Replace with the ID of the folder in Google Drive where you want to store the files.

// This function is triggered every time the form is submitted.

function onFormSubmit(e) {

var responses = e.response.getItemResponses();

// Loop through each form response.

for (var i = 0; i < responses.length; i++) {

var response = responses[i];

// Check if the response is a file upload question.

if (response.getItem().getType() == FormApp.ItemType.FILE_UPLOAD) {

var fileBlob = response.getResponse(); // Get the uploaded file.

var folder = DriveApp.getFolderById(folderId);

var fileName = response.getItem().getTitle(); // Use the question title as the filename.

folder.createFile(fileBlob).setName(fileName); // Save the file to Google Drive.

}

}

}

IMG-20240419-WA0039

Replace the last content with the given one

Method 2: Run The Script

Get the Form and Folder IDs. To run the script, here are the steps:-

Step 1: Replace form ID

Replace ‘YOUR_FORM_ID’ with the ID of your Google Form. You can find this ID in the URL of the form.

IMG-20240419-WA0036

Copy the URL to replace ‘YOUR_FORM_ID’

IMG-20240419-WA0038

Replace form id

IMG-20240420-WA0003

Press Ctrl+V to replace the Form ID

Step 2: Replace folder ID

Replace ‘YOUR_FOLDER_ID’ with the ID of the folder in your Google Drive where you want to store the files. If you don’t have the ID, you can get it from the URL when you’re in the folder.

IMG-20240420-WA0002

Replace folder id

IMG-20240420-WA0004

Press Ctrl+V to replace the Folder ID

Step 3: Save Script

Save the script.

IMG-20240419-WA0041

Save the script.

Step 4: Click triggers

Click on the clock icon (Triggers) in the script editor toolbar.

IMG-20240419-WA0043

Click triggers

Step 5: Set up a trigger

Set up a trigger to run the ‘On Form Submit’ function every time the form is submitted.

IMG-20240419-WA0046

Click on “Add Trigger”

IMG-20240419-WA0042

Set up a trigger to run the ‘on Form Submit’

Importance of Uploading Files to Google Drive from Google Forms

  1. Easy access and sharing: As soon as the file is uploaded, accessing it and sharing it among collaborators is straightforward. It also has a significant function that lets users control who can view, edit, or comment on the files.
  2. Automatic organization: Google Drive provides various features, such as folders, tags, and more, that make it easy to find specific files. Users can also customize folders to categorize the uploaded files and search for them specifically.
  3. Security and backup: Google Drive has strong security that protects all the uploaded files. 
  4. Centralized storage: Every file uploaded using Google Forms is appropriately stored in Google Drive. This ensures that all related files and data are arranged in one location, which helps with control and access.
  5. Version control: Google Drive automatically saves file versions so users can access older versions when necessary. This feature is beneficial when several people work on the same file, as the changes can be monitored and reversed.

Conclusion

This guide covered uploading files to Google Drive from Google Forms. You learned how to create a form with a file upload question and automatically store uploaded files in your Drive. Google Forms (free) lets you create surveys and collect files, while Google Drive stores them securely. This combo offers easy access, organization, security, and version control. Overall, uploading files from forms to Drive streamlines data collection and management.

FAQ’s – Upload files to Google Drive from Google Forms

Can you upload a Google Form to Google Drive?

No, you cannot upload a Google Form itself to Google Drive.

Does Google Forms have a file upload option?

Yes, Google Forms has a file upload option that allows respondents to upload files.

What is file upload in forms?

The file upload option in Google Forms lets people submitting the form upload files to your Google Drive.

Can you move Google Forms to a folder?

Yes, you can move a Google Form to a folder in your Google Drive.

Why won’t Google Forms let me upload a file?

Google Forms itself cannot upload files. There might be an issue with the form settings or respondent permissions.



Previous Article
Next Article

Similar Reads

Google One vs Google Drive: Pricing, Storage, and Feature 2024
When it comes to cloud storage, it is impossible not to think about Google Drive and One Drive. These are two of the most popular cloud storage and file-sharing platforms out there. While both of them provide useful features for storing and accessing your documents, photos, videos, and other files from any device with an internet connection, there
6 min read
Google Drive Vs Google Photos
Do you know the difference between Google Drive and Google Photos? You may get frustrated with photos, videos, documents, and more, and keeping it all organized can be a tough task. Enter Google's power duo, that is Google Drive and Google Photos. Both offer cloud storage, but which one stays supreme for your photos, videos, and important files? Ge
5 min read
Create a BMI Calculator using Google Forms and Google Sheets
How to Create BMI Calculator in Google Forms What is BMI?How to Create a Google Form for BMI CalculationCreating a Google Form for BMI CalculationEstablishing the BMI calculatorBMI Calculations in Google SheetsConclusionFAQS on BMI Calculator Tired of those confusing weight charts and old-fashioned BMI calculators? Want a quick and easy way to see
6 min read
How to Assign Tasks in Google Drive
Ever wondered how to make teamwork a breeze on Google Drive? Well, you're in for a treat! Learn the easy way to assign tasks and make collaborating with others super simple. From managing projects to working together smoothly, we'll show you the ropes. Get ready to boost your teamwork with Google Drive – it's easier than you think! The viewers who
7 min read
What the Duet AI side panel can do in Gmail, Google Drive, &amp; Docs
Google is adding more AI to Workspace with the addition of Duet AI, a new contextual AI partner that works in real-time. You can now use this side panel functionality in the Workspace online applications. It lets you ask Duet to make presentations, email, and document summaries. The tool was first noticed at Google I/O in May and next in August at
10 min read
WhatsApp backups to impact Google Drive Storage: What it means for Users
Go into the current policy move by WhatsApp, which will now cause implications for Google Drive storage of Android users. Explain the consequences, become familiar with scheduling, and find out what this act could mean for users' practices of data storage. WhatsApp has made a big change, especially for Android users. Before, they had this rule call
3 min read
Google Drive Improves Video Playback, and Search Experience on iOS
For many users, Google Drive is an essential cloud storage solution. However, video playback within the app could sometimes be clunky, with buffering interrupting the viewing experience. Additionally, navigating through a vast amount of files using the search function could be cumbersome. Thankfully, Google has addressed these pain points with its
5 min read
Google Drive Tips for Mobile Users
Imagine a safe deposit box in the sky, accessible from anywhere! That's Google Drive, your secure cloud storage solution for all your important files. Ditch your bulky hard drive and keep everything from documents and photos to videos and presentations in this online storage haven. Google Drive lets you access your files anytime, anywhere, on any d
6 min read
Best Google Drive Alternatives in 2024
In today's digital era, backing up all our important files and data has become a necessity for everyone. Lots of people use Google Drive and Dropbox because these days they're easy and you can get to your stuff from anywhere. But if you want something different or better, there are a lot of other good options out there. Let's take a look at some of
7 min read
10 Ways to Organize Your Digital Life with Google Drive
Google Drive is the best cloud storage space that allows you to safely store different files in folders of various formats and access them from anywhere you want. These are easier to access and work. Undeniably, Google Drive is an effective tool to store digital assets. It is a quick way to access and share digital files with others. Even the peopl
10 min read