Moving filtered rows from one worksheet to another in excel 365. I used the “Move Rows Between Tables” sample in the code editor. My source table is 40k rows with about 40 columns. I filtered by a single column and copied 12k rows to a new table. That part is nearly instant. Those 12k rows then need removed from the source and this is where it gets very slow. (about 15min)
const sheet = sourceTable.getWorksheet();
rowAddressToRemove.reverse().forEach((address) => {
sheet.getRange(address).delete(ExcelScript.DeleteShiftDirection.up);
});
Pretty certain the slowdown is from the constant shift of data. If I sort my table by the filtered column I can manually select all the rows I need filtered out at once and delete them in a second. It’s my first time looking at excel’s API, is there a faster way to do this from a script? Can you programmatically filter the table and select a range to delete all at once?