Receive Files in Google Drive with Forms
You may need to collect information from customers or staff members. For instance you may want job applicants to be able to upload their resumes on your company site or customers to be able to submit design requests.
Google Forms would have been a perfect solution here but unfortunately you cannot upload files to Google Drive through Forms.
What you can do is create a regular web form (written in HTML and CSS) and then use Google Scripts to upload the content of this form into a folder in your Google Drive.
Before diving into the implementation, take a look at this sample form. When you submit the form, it will create a new folder, corresponding to your name, in my Google Drive and upload the file in that folder This is a public form and you don’t even need to have a Google Account to upload files. The form even works on mobile devices.
Click here to make a copy of the Google Script into your Google Drive.
This is vanilla form with a text field, a file input field and a form submit button. You can open the form.html file to apply your own CSS styles or add more input and text area fields.
From the Run menu, choose doGet and authorize the script. The script needs these permissions since the form will be uploading files to your Google Drive.
Next choose Deploy as Web App from the Publish menu. Click Save New Version, choose Anyone, even Anonymous from the drop-down and click the Deploy button.
The files will be uploaded to a folder called "CEOITBOX" . You can change this in the script as per your requirement.
The Google Script will now offer you a form URL. Anyone can now use this form to upload files to your Google Drive.
<form id="myForm">
<label>Your Name</label>
<input type="text" name="myName">
<label>Pick a file</label>
<input type="file" name="myFile">
<input type="submit" value="Upload File"
onclick="google.script.run
.uploadFiles(this.parentNode);
return false;">
</form>