Clear Range
Clears the contents, formats, or both from a range of cells in an Excel worksheet.
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.
Input
- Client Id - The client ID from the Connect node (optional if using direct credentials).
- Workbook Id - The workbook ID from Get Workbook or Create Workbook node.
- Worksheet Name - Name of the worksheet containing the range. Default is "Sheet1".
- Range Address - Range address in A1 notation (e.g., A1:C10).
Options
- Credentials - OAuth2 credentials (optional, alternative to using Client ID).
- Clear Type - What to clear from the range:
- All - Clears both contents and formatting (default)
- Contents - Clears only values and formulas, preserves formatting
- Formats - Clears only formatting, preserves values
Output
- Success - True if the range was cleared successfully.
- Range Address - The range address that was cleared.
- Clear Type - The type of clear operation performed.
Examples
Clear All (Contents and Formatting):
// Input
Range Address: "A1:C10"
Clear Type: "All"
// Clears everything from A1:C10
Clear Only Contents:
// Input
Range Address: "D1:D100"
Clear Type: "Contents"
// Removes values/formulas but keeps formatting
Clear Only Formatting:
// Input
Range Address: "A1:Z100"
Clear Type: "Formats"
// Removes formatting but keeps values
Clean Data Range:
Get Workbook
→ Get Range (read old data)
→ Clear Range (clear for new data)
→ Set Range (write new data)
Clear Types Explained
All:
- Removes cell values
- Removes formulas
- Removes all formatting (fonts, colors, borders, etc.)
- Resets cells to default state
Contents:
- Removes cell values and formulas
- Preserves all formatting
- Useful when you want to update data while keeping the look
Formats:
- Removes all formatting
- Preserves cell values and formulas
- Useful for resetting visual styling
Use Cases
- Prepare worksheets for new data
- Clear temporary calculation results
- Reset formatted ranges to default
- Remove old data while preserving structure
- Clean up worksheets before repopulation
Tips
- Clear Range is faster than deleting and recreating rows/columns
- Use "Contents" when you want to preserve cell styling
- Use "All" for complete cleanup
- For clearing entire sheets, use Clear Sheet node instead
- Clearing does not delete rows or columns, only empties cells
Common Errors
ErrInvalidArg - "Range address cannot be empty"
- Solution: Provide a range in A1 notation (e.g., A1:C10)
ErrNotFound - "Range not found in worksheet"
- Solution: Verify the worksheet name and range address are correct
ErrInvalidArg - "Workbook ID cannot be empty"
- Solution: Ensure you've called Get Workbook first
ErrGraph - "Failed to clear range"
- Solution: Check that you have write permissions to the file