Sunday 16 December 2018

Create a Table in a Doc

The following Google Apps Script code was developed to append tables to an existing Google Doc, that was originally being created to contain student feedback. It will insert a table with 3 rows and 1 column, which can be used for better laying out text.

You will need to feed in the ID of your file so that the DocumentApp can then open it and get the body ('getBody') for you to be able to start making changes. We then create a variable for the new table and append it to the document whilst providing an array of cell contents "([['Row 1, Cell 1']])". Finally we then get the cell of this new table and add two more rows.

Doc for Tables.doc

No comments:

Post a Comment