I would like to copy the whole table from one sheet(inputSheet) to another(outputSheet), and then, keep copying & adding more tables to the same ouputSheet
Here are some things I have tried:
function main(workbook: ExcelScript.Workbook) {
const inputSheet = workbook.getWorksheet("Input")
const outputSheet = workbook.getWorksheet("Output")
// Worksheet addTable: The argument is invalid or missing or has an incorrect format.
const tableRange = inputSheet.getTables()[0].convertToRange()
const table = outputSheet.addTable(tableRange, true)
// Worksheet addTable: The argument is invalid or missing or has an incorrect format.
const tablaRange2 = inputSheet.getTables()[0].getRange()
const tabla2 = outputSheet.addTable(tablaRange2, true)
// this one kind of work but :
// 1- have to know the range in advance
// 2- the second table I copy(to the same outputSheet), gives an error saying that headers can't have rich text.
const newRange = outputSheet.getRange("A1:Z20")
.copyFrom(inputSheet.getRange("A1:Z20"), ExcelScript.RangeCopyType.all, false, false);
const newTable = eneSheet.addTable("A1:Z20", false)
}
I'm hoping there's something straightforward similar to this way to copy a sheet:
const newSheet = previousSheet.copy(ExcelScript.WorksheetPositionType.after, anotherSheet)
But haven't found a table or sheet method that would do that.