Auto remove blank rows in google docs

Hi there

I have a table that I need populated (which is working perfectly, populating onto each {{entry}} on the table

Is there a way I can auto remove some of the rows that aren’t populated

e.g. I have 4 products but I have the 10 rows. I want to remove the rows after the last product entry

I don’t think its possible to do this with the API @Jason_Blignaut . You probably have to use a Google Apps Script within the sheet which runs a function to find empty rows.
This is an example, which only deletes the first empty row it find, based on a check of the first column “A:A”:

function getFirstEmptyRowByColumnArray() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var column = ss.getRange('A:A');
  var values = column.getValues(); // get all data in one call
  var ct = 0;
  while ( values[ct] && values[ct][0] != "" ) {
  console.log(`Deleting ${ct+1}`);

Thanks Bjorn. Yeah, I figured I may have to use a google script. The issue is that all columns are filled with the {{dynamic data}} so I don’t think Google would recognise it as empty.

The other thought I had was taking an excel sheet and pasting that data into the google doc because you can “Add row” with make