Creating a table in Google Doc from an Array of information

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:

In implementing the 4th approach, there were still a few pitfalls/learnings down the road, which I want to share:

  1. iterate through the reserve(body.content) array
  2. filter if “table” exists
  3. reserve bundle order by setting a variable to: “total number of bundles” +1-“bundle order position”
  4. (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}}
  5. search rows in google sheets whose content you want to insert in google docs
  6. aggregate the desired content and the tables’ start index, end index and reversed order to an array
  7. iterate array
  8. 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”
    }
    }
    ]
    }
3 Likes