How to Generate PDF files from Google Form Responses
With Document Studio, you can easily generate PDF files, or documents of any other file type, when someone submits your Google Form. The generated documents are stored in Google Drive, you can email them to the form respondent, share the file with team members or even print the documents via Google Cloud Print.
This step by step tutorial explains how to generate a PDF file from Google Form submissions.
Step 1: Create the Google Form
Go to forms.google.com and create a Google Form. We’ll build a Contact Us form that asks for the respondent’s name, email, postal address and comments.
Step 2 - Link Google Form to Google Sheet
Go to the Response Tab, click the 3-dot vertical menu and select the response destination. The Google Form should be storing the responses in a Google Spreadsheet for the document merge add-on to work.
Step 3: Create the Document Template
Build a new template using either Google Docs, Spreadsheet or Google Slide. We’ll create a one-page slide presentation with template {{markers}}
corresponding to the various questions in our Google Form.
Please ensure that the template markers in the document template are correctly mapped and that the marker name should be the same as your form question. For instance, if you have a question in Google Forms that is titled “Your postal address?”, the marker name in the document template should read {{Your postal address?}}
.
Step 4: Configure Document Studio
Open the Google Forms responses spreadsheet, go to the add-ons menu and choose Document Studio.
4a. Configure Document Template
Go to the Document Merge section and select the template you created in the previous step. You can also personalize the file name to include form answers.
4b. Configure Email Template
Open the Google Forms Merge section and design your email template. You can use can column header in the email subject and body using the {{marker}}
notation. The merged document will be added to the email as an attachment. You can also choose the email field in the “Send Email” drop-down and the email will be sent to the form respondent.
Tip: If you would like to include all the form answers in the email, use the {{All Answers}}
marker anywhere in the message body and it will be replaced with an HTML table containing all the form answers.
4c. Configure Google Drive
Your generated documents will be stored in Google Drive. Expand the “Upload to Google Drive” section and select the folder in Drive where the documents would be saved. You can also customize the subfolder path with form answers so the form response files are stored in separate folders.
\\Comments\\{{Name}}
Step 5: Merge on Form Submit
The configuration is complete and we are ready to run the form submit trigger that will automatically merge documents and send the emails as soon as a new form is submitted.
Go to the Save Configuration section, check the “Merge on Form Submit” option and click the Save Settings button. Now submit a test form entry and it should create the documents and send the emails.
Amit Agarwal
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.
Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory