我想将整个表从一张表(inputSheet)复制到另一张表(outputSheet),然后继续复制并添加更多表到同一个 ouputSheet
以下是我尝试过的一些事情:
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)
}
我希望有一些类似于这种方式来复制工作表的简单方法:
const newSheet = previousSheet.copy(ExcelScript.WorksheetPositionType.after, anotherSheet)
但是还没有找到可以做到这一点的表格或工作表方法。