Hi there,
first post.
I hope this community becomes the No.1 reference for integromat/make (once it will show up in google search results).
I had the same issue and came across several approaches:
- using MS docs templates: [Integromat Community | Question: How can I insert JSON array as a table in a Google Doc | Facebook
- create a new doc with html code inside: Integromat Community | Hello integromaters, I need to make a report with information from a google sheets to a google docs as a listing, like this image | Facebook
- using this python library with this workaround to run python. (I have not explored this approach, which might be worth another thread).
- google docs API calls. Thanks for drawing my attention to this approach @zezutom !
In implementing the 4th approach, there were still a few pitfalls/learnings down the road, which I want to share:
- iterate through the reserve(body.content) array
- filter if “table” exists
- reserve bundle order by setting a variable to: “total number of bundles” +1-“bundle order position”
- (optional) get a reference from the first cell of a table: {{9.body.content[30.
reversed order
].table.tableRows[1].tableCells[1].content[1].paragraph.elements[1].textRun.content}} - search rows in google sheets whose content you want to insert in google docs
- aggregate the desired content and the tables’ start index, end index and reversed order to an array
- iterate array
- make a POST request to this URL: /v1/documents/{{9.documentId}}:batchUpdate with the following body:
{
requests: [
{
insertTableRow: {
tableCellLocation: {
tableStartLocation: {
index: {{9.body.content[43.reversed order
].startIndex}}
},
rowIndex: 1,
columnIndex: 0
},
insertBelow: false
}
},
{
insertText: {
location: {
index: {{(9.body.content[43.reversed order
].endIndex - 2)}}
},
text: “XY”
}
}
]
}