Populating a table in a google doc template

The way I do this sort of task is I have two template google docs. The one template is the main document. It has logos and artwork in the correct places. The second doc is a doc of tables. Each table has a header row and a content row with placeholders. The tables are styled because the tableRow.copy() method mostly (yeah mostly) carries over all formatting to the destination.
The workflow being that my data source specifies the tables it should be inserted into as well. So my flow is to make a copy of the main doctemplate and then flow down through my data and copying the required table from the tables doc, filling it using the method I showed and then grabbing the next table and repeating.
The tables doc is easy to understand as body.getTables() get’s all the tables without messing about with elements and so on.
Hope that helps :blush:

3 Likes