Upload Files to Google Drive with Google Apps Script

Google Forms do not support file uploads but you can use Google Apps Script for uploading files to Google Drive through an HTML web form. For instance, you can share the form with your class or with your clients and they can directly upload assignments, photographs, etc. in your Google Drive.

There are two steps involved here. First you need to create an HTML form using standard HTML, CSS and JavaScript. You can use the Add-ons CSS package to give the standard Google look-n-feel to your form. Here’s a sample form:

The server side code includes a function for processing the form input. It reads the uploaded file as a blob and saves the blob as a new file into your Google Drive. The file name, extensions and content type are preserved.

You can save the two files and deploy the script as a web app as demonstrated in the GIF animation below.

A similar technique is used for hosting podcasts and websites on Google Drive.

Upload Files to Google Drive