Reputation: 148
I'm building a form using Google Forms, and then taking the form out into my web page so I can directly edit the form (so I do have complete control over the form code).
Right now I'm able to submit the results send to Google Docs (published on 2012), and then have the results emailed me to me (published on 2012).
I want to add a file attachment to these submissions, using:
<input type="file" name="datafile" id="filedata" size="40">
I know I can use mailApp.sendEmail
's advanced arguments, specifically the attachments argument, or the inlineImages argument.
But how do I access the file values in order to attach them to send?
Upvotes: 10
Views: 10507
Reputation: 38391
As of July 6th, 2024, this question looks obsolete. Nowadays, Google Forms has File Upload among the built-in question types.
It's worth noting that this question type can't be added using Google Apps Script. It should be added using the Google Forms editor.
Regarding
I want to add a file attachment to these submissions, using:
As of today, this is not possible. Instead, use the question type File Upload.
You should grab the form submission data to access the File Upload. This could be done using a form submit trigger from the script in the form or a script in a spreadsheet.
The File Upload response contains the id of the uploaded file. To grab the file and send it as an email attachment, use DriveApp.getFileById(file_upload_response)
.
Resources
Related
Upvotes: 0