Function to return all the data within a table

62 views Asked by At

The following function returns the data of Table1 excluding the headers:

function main(workbook: ExcelScript.Workbook) {
    let ws = workbook.getWorksheet("Sheet1");
    return ws.getTable("Table1").getRangeBetweenHeaderAndTotal().getValues();
}

How do I get it to return ALL the data, including the headers?

1

There are 1 answers

0
taller On BEST ANSWER

Please try.

function main(workbook: ExcelScript.Workbook) {
  let ws = workbook.getWorksheet("Sheet1");
  return ws.getTable("Table1").getRange().getValues();
}

Microsoft documentation:

getRange()