Delete Cell
This node deletes the specified cell 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 ContinueOnError property is true, no errors will be caught when the project is executed even if a Catch node is used.
Input
- Excel File Descriptor - The ID of the Excel file descriptor to remove cell from. This ID is generated by the Open Excel or the Create Excel node.
- Cell - The location of the cell to delete. (e.g. A1, B8)
Options
-
Target - Specifies whether to delete the active cell or a specific cell.
active-cell- Deletes the active cell.specific-cell- Deletes a specified cell.
Note: If no cell is specified when deleting the active cell, the current selected cell will be deleted.
How It Works
- Validates Input: Checks that file descriptor and target option are provided
- Verifies Target: Ensures a valid target option is selected (active-cell or specific-cell)
- Checks Cell Input: If specific-cell is selected, validates that a cell reference is provided
- Retrieves Handle: Gets the Excel file handle from the descriptor
- Validates Cell: If specific-cell, validates the cell reference format (e.g., A1, B5)
- Deletes Content: Sets the cell value to empty string (""), effectively clearing the cell
- Preserves Structure: The cell remains in the sheet but its content is removed
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-cell target, a valid cell reference must be provided (e.g., A1, B5, C10)
- When using active-cell target, an active cell must be set (use Set Active Cell if needed)
Error Handling
| Error Code | Description | Solution |
|---|---|---|
| Core.Excel.DeleteCell.ErrOnCreate | Configuration parsing failed | Check node configuration is valid |
| Core.Excel.DeleteCell.ErrOnMessage | Message parsing failed | Verify input message format |
| Core.Excel.DeleteCell.ErrTarget | Target option is empty or invalid | Select either active-cell or specific-cell |
| Core.Excel.DeleteCell.ErrCell | Cell reference is empty or invalid | Provide valid cell reference (e.g., A1) when using specific-cell |
| Core.Excel.DeleteCell.ErrFileDescriptor | File descriptor is empty or file not found | Ensure file is opened/created before deleting cell |
Usage Examples
Example 1: Delete Specific Cells
Clear specific cells from a worksheet:
- Open Excel (data.xlsx) -> fileDesc
- Delete Cell:
- Excel File Descriptor: fileDesc
- Cell: "A1"
- Target: specific-cell
- Delete Cell:
- Excel File Descriptor: fileDesc
- Cell: "B5"
- Target: specific-cell
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 2: Delete Active Cell
Clear the currently active cell:
- Open Excel (report.xlsx) -> fileDesc
- Set Active Cell (fileDesc, "C10")
- Delete Cell:
- Excel File Descriptor: fileDesc
- Target: active-cell
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Example 3: Conditional Cell Deletion
Delete cells based on conditions:
- Open Excel (inventory.xlsx) -> fileDesc
- Get Cell Value (fileDesc, "D5") -> stockLevel
- If {{stockLevel}} == 0:
- Delete Cell:
- Excel File Descriptor: fileDesc
- Cell: "D5"
- Target: specific-cell
- Set Cell Value (fileDesc, "E5", "Out of Stock")
- Save Excel (fileDesc)
- Close Excel (fileDesc)
Usage Notes
- Delete Cell only clears the cell content, it does not remove the cell from the sheet structure
- The cell remains in place but contains an empty value
- Cell formatting, borders, and styles are preserved
- To completely remove a cell and shift others, use Delete Row or Delete Column instead
- When deleting the active cell, make sure an active cell is set first
- The operation affects only the currently active sheet
- Multiple cells can be deleted by calling the node multiple times
- Remember to save the file to persist the changes
Tips
- Use Delete Cell for clearing individual cell values while preserving structure
- For removing entire rows or columns, use Delete Row or Delete Column nodes instead
- Consider using Set Cell Value with empty string as an alternative approach
- When deleting multiple cells, process them in a loop for efficiency
- Verify cell references before deletion to avoid clearing wrong data
- Use Get Cell Value before deletion if you need to backup the data first
- Remember that deleted (cleared) cells will show as empty in formulas
- Save the file after deletion to make changes permanent
Related Nodes
- Delete Row - Delete entire rows
- Delete Column - Delete entire columns
- Set Cell Value - Set a cell to a specific value
- Get Cell Value - Read cell value before deletion
- Set Active Cell - Set the active cell for deletion
- Save Excel - Persist changes to disk