In Excel, a table can be resized by dragging its lower-right corner, which makes a table bigger (or smaller) without inserting (or removing) any cells in the worksheet (see “Sizing handle” in Microsoft’s “Overview of Excel tables”). The equivalent action can be done through the VBA API using “ListObject.resize”: “The Resize method allows a ListObject object to be resized over a new range. No cells are inserted or moved.”
How can this be done through the JavaScript API? I’m probably overlooking the obvious, but the class “Table” at least doesn’t seem to offer a method “resize”.
Good news, we have created this API and We release table.resize() last month together with SAC, now you could try it out. here is the code sample。
await Excel.run(async (context) => {
// Retrieve the worksheet and a table on that worksheet.
const sheet = context.workbook.worksheets.getItem("Sample");
const expensesTable = sheet.tables.getItem("ExpensesTable");
// Resize the table.
expensesTable.resize("A1:D20");
await context.sync();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With