I am trying to remove some rows in a table via Excel add-in. The code that I am using is below:
var table = ctx.workbook.tables.getItem('TableName');
if (Office.context.requirements.isSetSupported('ExcelApi', 1.2) === true) {
table.clearFilters();
}
var tableRows = table.rows.load('items');
ctx.sync().then(function () {
for (var i = (tableRows.count - 1); i >= 0; i -= 1) {
var row = tableRows.getItemAt(tableRows.items[i].index);
row.delete();
}
});
This works fine in Excel online including Internet Explorer 11. Also it works with version 1601 (Build 6741.2088) and later. However, it doesn't work with version 1509 (Build 4266.1001). In this version I get the values and indexes of row items as undefined. How can I resolve this issue?