Tuesday, 7 April 2026

Append Sheet data to a Doc with varying Table sizes

The following Google Apps Script is a slight variation of my post on bulk creating Google Docs from Google Sheet data.

This time I was looking to work with Sheet data where students would get a mark for each module they completed, but not all students completed the same number of modules. I wanted to translate this information into a table in a Doc, one row per module, and avoid empty rows.

So I ultimately went from a table with a header row and one more row for the first module mark (because everybody completed at least one), to having the Apps Script check for any further module results and then appending a new table row to add them.
Screenshot of a Google Doc with a Table for adding Module scores in