How to autofill a Google Doc template from a Google Form

Auto-filling a Google Doc template with data from Google Forms streamlines the process of generating documents such as invoices, reports, and letters. ‍ This automation saves time, reduces manual entry errors, and ensures consistency across documents. It's particularly useful for businesses and individuals who frequently generate documents with similar structures but varying content.

Connect your Google Form to a Google Sheet

First, we need to connect our Google Form to a Google Sheet, so that new form responses are automatically added to the sheet. In your Google Form, go to the responses tab. Then click on the Link to Sheets button. You will be prompted to select a destination for responses. Select Create a new spreadsheet. Then click Create. This will open a new Google Sheet in a new tab. Copy the URL of this Google Sheet, we will need it in the next step.

Create a Google Doc template

Next, we'll need to make the Google Doc template that will get populated with the data from our Google Form, via the Google Sheet. You can either start from scratch, or adapt an existing template that you have. ‍ We'll designate which parts of the document will be replaced with spreadsheet data by using the > syntax. (make sure there are no spaces between the curly braces and letters) ‍ The key here is that whatever is inside of the curly brackets > must exactly match the name of the column header in your Google Sheet, including the same capitalization and spaces. So for example, if in our Google Sheet we have a column for First Name, then everywhere we want that value to be inserted into the template we'll need to put >. ‍ ‍

Connect your Google Sheet to Lido

We will use Lido, a new spreadsheet built to automate repetitive tasks, to merge our Google Sheet data into the Google Doc template to create new Google Docs. There is a free tier with paid plans as well. You can create a new account here: https://www.lido.app/go/signup ‍ Step 1. From the Lido Files page, click Create a new file ‍ Step 2. then click Connect Data and select Google Sheets. ‍ Next, paste in your Google Sheet URL. If it's your first time connecting a Google Sheet to Lido, you'll need to authenticate into a Google account that has access to the sheet you're trying to connect. ‍ ‍ Select all of the columns that you want to connect to Lido. Make sure to connect all of the columns that are referenced as variables in your Google Doc template. ‍ Click Add Data. ‍ Your Lido spreadsheet should now have connected data from your Google Sheet. It will look like this: ‍ ‍ ‍

Add the =CREATEGOOGLEDOC() formula

Now we need to add the formula to create the Google Docs with our spreadsheet data. The formula looks like this: ‍ ```=CREATEGOOGLEDOC(,,,)``` ‍ Drive Credential - if its your first time, you'll need to add a credential to give Lido access to reading and updating your Google Docs. ‍ Template file - use the file picker for Google Drive and choose your Google Doc template file. ‍ File Name - name of the new Google Doc that is being created. You can make dynamic file names such as:
‍ ```="Application Form for " & B2``` ‍ Status Cell - when the Google doc is generated successfully, the full path to the new Google Doc will be put in this cell. Usually, its the next column over from CREATEGOOGLEDOC. ‍ for example: https://docs.google.com/document/d/1qI1byK0NzTV79QfRpwSNx99-lGPjChm1sL75fQCBIAU/edit?usp=drivesdk

Step 1: Create a computed column in your spreadsheet table.
  1. Hover your mouse over the green table of records from your Google Sheets. You'll see a "+" sign.
  2. Choose "Add Computed Column".
  3. Name the Column "Create Doc" (or whatever)
  4. Start Typing the =CREATEGOOGLEDOC() formula in the second row.

A Computed Column in Lido copies the same formula down to every row and grows as your data grows.

Step 2: Add a Google Drive Credential.

You can do so by choosing "Add Credential" in the first argument of CREATEGOOGLEDOC. Follow the prompts.