In my workflow, I first download a template and retrieve a set of data from Google Sheets for different items (e.g., Product A, Product B, Product C). It’s important to note that these products are not fixed—they change every week. Each item has the same categories in different columns (e.g., item, date, quantity, unit price).
I need to fill this data into a table in a Word document. To do this, I use a loop or section in the “Fill a Document with a Batch of Data” module. However, I need the document to generate the same table on different pages, but per product.
When I set a “group by product” in the module, it works as expected, but it creates separate documents for each product. What I need is to have everything in the same document.
The problem with creating separate documents is that it results in too many operations being counted, which makes the process less efficient.
I would really appreciate any guidance or suggestions on how to approach this issue and find a solution. Thank you!
Essentially your input will be a variable number of groups of items, then you want one table per group in the Word Document and each table needs to start on a new page?
Group by product gives you the data separated as you want it separated but results in a new document for each group.
The only way I can think about handling this is creating multiple templates, each with a variable number of tables, count the number of groups you have, then use a router to fill the corresponding template.
For example, your Word Template might consist of a Title page, a single table page, an ending page - 3 pages total. This would work for a single product.
If you have 3 products, then your template would have 5 at least pages: Title, Product 1 Table, Product 2 Table, Product 3 table, ending page. Some of the tables may span beyond a single page.
You’d have to build this out and account for the max number of Products you might encounter, one route for each
I feel like this would be a mess to build in Make, mostly because Microsoft’s API isn’t easy to use, which is why the Microsoft Word Template module can’t be as flexible as you might need.
I’ll mention another approach in another post to keep them separated.
Another approach is more complicated, but might get closer to what you need.
This involves Google Docs since GDocs supports creating new documents from HTML and downloading docs at Word DOC format.
Create your template in Google Docs.
Within the doc, insert a placeholder for your tables, something unique like {tables}
Aggregate your data into HTML tables
Download the template as HTML and replace your placeholder with the table HTML
Create a new doc using the new HTML
Download the new doc in Word Doc format
Upload the data to its final destination
Downsides to this method (among others) are Google Docs doesn’t support some of the more advanced formatting features that Word does, the formatting might look a little off, you might still not be able to get your tables on new pages.