Delete Column
Deletes a column in 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 ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Input
- Excel File Descriptor - The ID of the Excel file to perform the delete operation. This ID is generated by the Open Excel or the Create Excel node.
- Column - The column to delete. (e.g.
AorBorG)
Options
- Target - Specify which column(s) to delete: active column or specific column.
- Active Column - Deletes the currently active column.
- Specific Column - Deletes the specified column.
How It Works
- Validates Input: Checks that file descriptor and target option are provided
- Verifies Target: Ensures a valid target option is selected (active-column or specific-column)
- Checks Column Input: If specific-column is selected, validates that a column letter is provided
- Retrieves Handle: Gets the Excel file handle from the descriptor
- Validates Column: If specific-column, validates the column reference format (e.g., A, B, Z, AA)
- Determines Column: For active-column, extracts the column letter from the active cell
- Removes Column: Deletes the entire column and shifts remaining columns to the left
- Preserves Data: All columns to the right of the deleted column shift left 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-column target, a valid column letter must be provided (e.g., A, B, Z, AA)
- When using active-column 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.DeleteColumn.ErrOnCreate | Configuration parsing failed | Check node configuration is valid |
| Core.Excel.DeleteColumn.OnMessage | Message parsing failed | Verify input message format |
| Core.Excel.DeleteColumn.ErrTarget | Target option is empty or invalid | Select either active-column or specific-column |
| Core.Excel.DeleteColumn.ErrColumn | Column reference is empty or invalid | Provide valid column letter (e.g., A, B, Z) |
| Core.Excel.DeleteColumn.ErrFileDescriptor | File descriptor is empty or file not found | Ensure file is opened/created before deleting column |
| Core.Excel.DeleteColumn.ErrCell | Active cell column cannot be found | Set active cell before using active-column target |
| Core.Excel.DeleteColumn.GetExcelHandle | Failed to retrieve Excel handle | Verify file descriptor is valid |
Usage Examples
Example 1: Delete Specific Column
Remove a column by letter:
- Open Excel (data.xlsx) -> fileDesc
- Delete Column:
- Excel File Descriptor: fileDesc
- Column: "C"
- Target: specific-column
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 2: Delete Active Column
Remove the column containing the active cell:
- Open Excel (report.xlsx) -> fileDesc
- Set Active Cell (fileDesc, "D5")
- Delete Column:
- Excel File Descriptor: fileDesc
- Target: active-column
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 3: Delete Multiple Columns
Remove several columns from a worksheet:
- Open Excel (spreadsheet.xlsx) -> fileDesc
- Delete Column (fileDesc, "F", specific-column)
- Delete Column (fileDesc, "E", specific-column)
- Delete Column (fileDesc, "D", specific-column)
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Note: Delete from right to left to avoid shifting issues.
Usage Notes
- Deleting a column removes the entire column and all its data from the sheet
- Columns to the right of the deleted column automatically shift left
- Column references in formulas are NOT automatically updated
- When deleting multiple columns, work from right to left to avoid reference shifting issues
- The active-column target uses the column of the currently active cell
- Column letters can be single (A-Z) or multiple (AA, AB, etc.)
- 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 columns
- When deleting multiple columns, delete from right to left (Z to A direction)
- Use Get Range to backup column data before deletion if needed
- Be aware that formulas referencing deleted columns will show #REF! errors
- Consider hiding columns instead of deleting if you might need the data later
- Verify column letter before deletion to avoid removing wrong data
- Use Get Column to inspect column contents before deletion
- Test on a copy of the file first when automating column deletions
Related Nodes
- Delete Row - Delete entire rows
- Delete Cell - Delete individual cells
- Insert Column - Insert new columns
- Get Column - Read column data before deletion
- Set Active Cell - Set active cell for active-column target
- Save Excel - Persist changes to disk