Delete a Table Row by Index
A 5-step recipe with Microsoft Excel. We can help you get access.
Recipe · 5 steps
Delete a Table Row by Index
with Microsoft Excel
Safely remove a single row from an Excel table by index.
- Open a persisting session so the deletion is committed to the stored workbook.
- Resolve the table on the worksheet that the row will be deleted from.
- Read every row before deleting so the caller holds a copy of the row about to be destroyed and can confirm the index points at the intended record.
- Delete the row at the supplied index. This is destructive, and every row after it shifts up by one, so any cached indexes are invalid afterwards.
- Re-read the rows to confirm the record is gone and to hand the caller the re-indexed row set for any further deletions.
What you'll need to have ready
- itemId: The drive item id of the workbook file.
- worksheetIdOrName: The worksheet holding the target table.
- rowIndex: The zero-based index of the row to delete, verified against the snapshot taken by this flow before the delete is issued.
For your developer
Arazzo workflow microsoft-excel:prune-table-row, 5 operations: createWorkbookSession → listTables → listTableRows → deleteTableRow → listTableRows. Specs on APIs.io.