0
votes

I'm pretty new to working with Google Apps Scripts - So I apologize in advance if the answer to this question is really obvious. Here goes: I have created a Google Doc from a spreadsheet. I've selected specific columns from the spreadsheet to display in a nicely formatted table in a new created Google Doc. I'd like to append a paragraph after the table has been created. I'd even be happy to append an additional row with a cell to the end of the table. I want to do this so I can simple write a little reminder at the end of the document.

I've tried using table.appendTableRow( index) where index is the number of the last row generated but that doesn't seem to be working. I've tried using body.appendTable( table) and then appending a row and cell and paragraph but that isn't working. Does anyone have any suggestions?

Thanks in advance

1

1 Answers

0
votes

Here you can add a row to the last table in your document.

var d = DocumentApp.getActiveDocument();
var body = d.getBody(); 
var tables = body.getTables();
tables[tables.length-1].appendTableRow().appendTableCell("yoyo");

If this is not what you are looking for please provide more details.

Hope it helps!