Delete Row
Deletes a row from an Excel file
Common Properties
- Name - The custom name of the node
- Color - The custom color of the node
- Delay Before (sec) - Waits in seconds before executing the node
- Delay After (sec) - Waits in seconds after executing node
- Continue On Error - Automation will continue regardless of any error. The default value is false
info
If the ContinueOnError property is true, no error is caught when the project is executed even if a Catch node is used.
Input
- Excel File Descriptor - Descriptor of the Excel file to delete row(s) from. This ID is generated by the Open Excel or the Create Excel node.
- Row Number - The row number(s) to delete. (e.g.
5or9)
Options
- Target - Select where to delete row(s)
- Active Row - Deletes the current active row
- Specific Row - Deletes a row by specifying the row number
- First Row - Deletes the first row in the sheet
- Last Row - Deletes the last row in the sheet
How It Works
- Validates Input: Checks that file descriptor and target option are provided
- Verifies Target: Ensures a valid target option is selected
- Checks Row Input: If specific-row is selected, validates that a row number is provided
- Retrieves Handle: Gets the Excel file handle from the descriptor
- Determines Row: Based on target option, identifies which row to delete:
- Active Row: Uses the row number from the active cell
- Specific Row: Uses the provided row number
- First Row: Uses row 1
- Last Row: Counts all rows to find the last one
- Removes Row: Deletes the entire row and shifts remaining rows upward
- Preserves Data: All rows below the deleted row shift up by one position
Requirements
- The Excel file must be opened with Open Excel or created with Create Excel
- A valid file descriptor must be provided
- When using specific-row target, a valid row number must be provided (must be greater than 0)
- When using active-row target, an active cell must be set
- The file must be saved after deletion to persist changes
Error Handling
| Error Code | Description | Solution |
|---|---|---|
| Core.Excel.DeleteRow.ErrOnCreate | Configuration parsing failed | Check node configuration is valid |
| Core.Excel.DeleteRow.ErrOnMessage | Message parsing failed | Verify input message format |
| Core.Excel.DeleteRow.ErrTarget | Target option is empty or invalid | Select a valid target option |
| Core.Excel.DeleteRow.ErrCell | Row number is empty for specific-row | Provide valid row number when using specific-row |
| Core.Excel.DeleteRow.ErrFileDescriptor | File descriptor is empty or file not found | Ensure file is opened/created before deleting row |
| Core.Excel.DeleteRow.ErrRow | No active row or deletion failed | Set active cell before using active-row, or check row exists |
Usage Examples
Example 1: Delete Specific Row
Remove a specific row by number:
- Open Excel (data.xlsx) -> fileDesc
- Delete Row:
- Excel File Descriptor: fileDesc
- Row Number: 5
- Target: specific-row
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 2: Delete Header Row
Remove the first row from a sheet:
- Open Excel (report.xlsx) -> fileDesc
- Delete Row:
- Excel File Descriptor: fileDesc
- Target: first-row
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 3: Delete Last Row
Remove the last row from a sheet:
- Open Excel (sales.xlsx) -> fileDesc
- Delete Row:
- Excel File Descriptor: fileDesc
- Target: last-row
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 4: Delete Active Row
Remove the row containing the active cell:
- Open Excel (inventory.xlsx) -> fileDesc
- Set Active Cell (fileDesc, "A10")
- Delete Row:
- Excel File Descriptor: fileDesc
- Target: active-row
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 5: Delete Multiple Rows
Remove several rows (delete from bottom to top):
- Open Excel (data.xlsx) -> fileDesc
- Delete Row (fileDesc, 10, specific-row)
- Delete Row (fileDesc, 9, specific-row)
- Delete Row (fileDesc, 8, specific-row)
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Usage Notes
- Deleting a row removes the entire row and all its data from the sheet
- Rows below the deleted row automatically shift upward
- Row numbers in formulas are NOT automatically updated
- When deleting multiple rows, work from bottom to top to avoid shifting issues
- The active-row target uses the row number from the currently active cell
- Row numbers start from 1 (not 0)
- Deleting the last row requires iterating through all rows to count them
- There is no undo operation - deletion is permanent once saved
- Remember to save the file to persist the changes
Tips
- Always backup important data before deleting rows
- When deleting multiple rows, delete from bottom to top (highest to lowest row numbers)
- Use Get Row to backup row data before deletion if needed
- Be aware that formulas referencing deleted rows will show #REF! errors
- Consider hiding rows instead of deleting if you might need the data later
- Verify row number before deletion to avoid removing wrong data
- For conditional deletion, use Get Cell Value to check row content first
- Test on a copy of the file first when automating row deletions
- Use first-row target to remove headers quickly
- Use last-row target to remove totals or summary rows
Related Nodes
- Delete Column - Delete entire columns
- Delete Cell - Delete individual cells
- Insert Row - Insert new rows
- Get Row - Read row data before deletion
- Set Active Cell - Set active cell for active-row target
- Save Excel - Persist changes to disk