How to Populate Google Docs Table with Linked Records from Airtable?

Hi everyone,

I’m working on an automation in Make where I need to generate Google Docs from a template. The data comes from Airtable, specifically from two tables:

  1. Quote Base (Main Record)
  2. Quote Products (Linked Records)

Each record in Quote Base is linked to multiple Quote Products. In my Google Docs template, I have a table where I want to insert a new row for each linked product. Here’s what I’ve set up so far:

  • Airtable Module: Watching for new responses and getting the record (including linked Quote Products).
  • Google Docs Module: Using a document template with tags like {{#products}}, {{qty}}, {{unit}}, {{price}}, etc.
  • Airtable Update Module: Updating the record with the generated document link.

The Problem:
I can’t get the automation to create a new row in the Google Docs table for each linked product. It seems like the loop ({{#products}}...{{/products}}) isn’t working as expected.

Question is:

  • How to properly iterate over the linked records so that each product gets its own row in the table.
  • How to structure the data between Airtable and Google Docs for the loop to work correctly.

Screenshots (Attached Airtable setup, Make scenario, and Google Docs template for reference.)

Any suggestions on how to fix this? Thanks in advance for your help!



Hi, this is a good one.
You need to generate the table with the content for it dynamically. At least this is what worked for me:

  1. Generate a doc from your template with the table having just a header row and another row which is just empty. No variables in this row required.
  2. Run a Get Content of a Document module. It will give you the info if where exactly your table in in the doc with all the indexes.
  3. Now you need to calculate how many rows your table should have based on the number products and through a custom API call add these rows to the table.
  4. Run another custom API call to populate the rows of the table. The secret here is to populate them starting from the last row and last cell and going backwards up through the table to the very first row and cell. Otherwise it would be harder to hit proper startIndex and endIndex for the cells.

To get the starting index of your cell, you can use this expression:
{{get(sort(xxx.body.content; “asc”; “table”); “1.table.tableRows.1.tableCells.1.startIndex”)}}
Based on this number you can calculate the rest of the indexes for you rows and cells.

Thanks you! Maybe you have ready template for it? As the process looks quite hard

Sorry, I don’t have a template as the project was a while ago. You can run a Get Content module and take a look at how indexes are assigned in a doc which contains content. It helped me a lot to come up with a pattern for my specific task of how to properly calculate indexes.
Also I’ve just thought that as an option you can create your doc through Create a document module. It works with basic HTML and you can aggregate your table into an HTML code and then send it with the rest of the content to a google doc. It doesn’t require calculating any indexes in this case.