Aug 30, 2016

How to Create Forms that allow File Uploads

Google Forms are probably the best service for creating online forms but they miss a few key features found in commercial web form builders. Google Forms do not allow file uploads, there’s no option for adding CAPTCHA in forms to prevent spam and, what may be of interest to the legal and retail industry, Google Forms cannot capture electronic signatures.

A school teacher may want a Google Form where students can upload assignments and the files are automatically saved to her Google Drive but in separate student folders. A company may want to build an online form where job applicants can upload their resumes in PDF or Word format. You cannot upload file attachments in Google Forms but there’s a workaround.

Open this sample web form and you’ll find that it has all the fields found in native Google Forms but a few extra ones. There’s a file upload button (demo), an area for visitors to e-sign the form (demo) and a CAPTCHA.

The form looks exactly like a Google Form and when you press the submit button, the files are sent to the form owner’s Google Drive while the entered data is saved in a Google Spreadsheet.

The form is integrated with Google Analytics so you can also track how many people opened your form, what browser they used and more. You can even choose to receive email notifications when people submit the form.

Configure & Install your File Upload Form

The first step is to create the form. If you know a bit of HTML, you can design the form yourself or use forms.studio. This is WYSIWYG form builder where you can drag and drop fields to build your form. Save the form and copy the embed code to your clipboard.

Now that you have the form code ready, you need to configure the Google Spreadsheet that will store your form responses.

Open your Google Spreadsheet and go to Tools -> Script Editor. Click the forms.html file and paste the form embed code. Save the file.

Go to Resources -> Developer Console Project and enable the Google Picker API. This will allow the form visitors to upload files directly to your Google Drive.

Open the install.gs file and specify the Drive folder where files would be stored, your time zone and the email address.

Go to Run -> Install to apply your configuration. You may have to authorize the first time you install the Google script.

Go to Publish -> Deploy as Web App, choose Me form Execute the app as and choose Anonymous under Who has access to the web app.

We are almost done.

Click the Deploy button and you’ll be presented with the public URL of your form. You can use Gmail Mail Merge to send the form to all your contacts in a personalized email.

Things to Know – File Upload Forms

If you wish to restrict the forms to users inside your Google Apps organization, choose your domain under Who has access to the app.

Unlike Google Forms, file upload forms cannot be embedded on other websites due to some restrictions around web apps made with Google Scripts.

If you later change any parameters in the install.gs file, you need to go to Run->Install to apply the new configuration.

To stop accepting new responses, go to Publish -> Deploy as web app menu and click the Disable link. Or change the Who has access option to Myself.