Skip to main content

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. A or B or G)

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

  1. Validates Input: Checks that file descriptor and target option are provided
  2. Verifies Target: Ensures a valid target option is selected (active-column or specific-column)
  3. Checks Column Input: If specific-column is selected, validates that a column letter is provided
  4. Retrieves Handle: Gets the Excel file handle from the descriptor
  5. Validates Column: If specific-column, validates the column reference format (e.g., A, B, Z, AA)
  6. Determines Column: For active-column, extracts the column letter from the active cell
  7. Removes Column: Deletes the entire column and shifts remaining columns to the left
  8. 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 CodeDescriptionSolution
Core.Excel.DeleteColumn.ErrOnCreateConfiguration parsing failedCheck node configuration is valid
Core.Excel.DeleteColumn.OnMessageMessage parsing failedVerify input message format
Core.Excel.DeleteColumn.ErrTargetTarget option is empty or invalidSelect either active-column or specific-column
Core.Excel.DeleteColumn.ErrColumnColumn reference is empty or invalidProvide valid column letter (e.g., A, B, Z)
Core.Excel.DeleteColumn.ErrFileDescriptorFile descriptor is empty or file not foundEnsure file is opened/created before deleting column
Core.Excel.DeleteColumn.ErrCellActive cell column cannot be foundSet active cell before using active-column target
Core.Excel.DeleteColumn.GetExcelHandleFailed to retrieve Excel handleVerify 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