I am trying to add cells to the existing table using insert API provided by office js. Microsoft official doc gave sample code to insert in sheet which works fine.
Excel.run(function (context) {
var sheet = context.workbook.worksheets.getItem("Sample");
var range = sheet.getRange("B4:E4");
range.insert(Excel.InsertShiftDirection.down);
return context.sync();
}).catch(errorHandlerFunction);
But i was trying do same with table on the sheet. But it is not working.
table = ctx.workbook.tables.getItem(tableName);
let range = table.getRange();
range.insert(Excel.InsertShiftDirection.down);
Is there a way to achieve this?