Create Excel
Creates a new 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 the 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 Path - Path of the new excel file to create.
Output
- Excel File Descriptor - Created excel file descriptor id.
Options
- Overwrite If Exists - Overwrites the existing file if the file path already exists.
How It Works
- Validates Input: Checks that the file path is provided and not empty
- Checks Existence: Verifies if a file already exists at the specified path
- Handles Overwrite: If the file exists and Overwrite If Exists is enabled, deletes the existing file; otherwise returns an error
- Creates File: Creates a new Excel file using the excelize library
- Generates Descriptor: Creates a unique file descriptor for the new Excel file
- Saves File: Saves the new Excel file to the specified path
- Sets Active Sheet: Activates the default sheet (usually "Sheet1")
- Returns Descriptor: Outputs the file descriptor for use in subsequent Excel operations
Requirements
- A valid file path must be provided (can be absolute or relative)
- The directory where the file will be created must exist
- Write permissions are required for the target directory
- If a file exists at the path and Overwrite If Exists is false, the operation will fail
Error Handling
| Error Code | Description | Solution |
|---|---|---|
| Core.Excel.Create.ErrOnCreate | Configuration parsing failed | Check node configuration is valid |
| Core.Excel.Create.OnMessage | Message parsing failed | Verify input message format |
| Core.Excel.Create.ErrCreateExcelFile | Path is empty | Provide a valid file path |
| Excel.Create.ErrCreateExcelFile | File already exists | Enable Overwrite If Exists or use a different path |
| Excel CreateExcel.ErrCreateExcelFile | Failed to save file | Check directory exists and write permissions |
Usage Examples
Example 1: Create a New Report
Create a new Excel file for daily reporting:
- Create Excel:
- Excel File Path: "C:/Reports/daily_report.xlsx"
- Overwrite If Exists: true
-> fileDescriptor
- Create Sheet (fileDescriptor, "Summary")
- Set Range (fileDescriptor, "A1:C1", ["Date", "Sales", "Revenue"])
- Save Excel (fileDescriptor)
- Close Excel (fileDescriptor)
Example 2: Dynamic File Creation
Create files with dynamic names based on current date:
- Get Current Date -> currentDate
- Format Date (currentDate, "yyyy-MM-dd") -> dateStr
- Create Excel:
- Excel File Path: "Reports/report_{{dateStr}}.xlsx"
- Overwrite If Exists: false
-> reportFile
- Set Cell Value (reportFile, "A1", "Report for {{dateStr}}")
- Save Excel (reportFile)
- Close Excel (reportFile)
Example 3: Automated Data Export
Export processed data to a new Excel file:
- HTTP Request (API endpoint) -> apiData
- Transform Data (apiData) -> processedData
- Create Excel:
- Excel File Path: "exports/data_export.xlsx"
- Overwrite If Exists: true
-> exportFile
- Set Range (exportFile, "A1", {{processedData}})
- Save Excel (exportFile)
- Close Excel (exportFile)
Usage Notes
- The created Excel file includes one default sheet (usually named "Sheet1")
- The file is saved immediately upon creation, so it exists on disk right away
- The file descriptor returned is required for all subsequent Excel operations on this file
- If Overwrite If Exists is false and the file exists, an error will be thrown
- The file path can be absolute (C:/path/file.xlsx) or relative (./file.xlsx)
- Supported file extensions are .xlsx and .xls
- The file is created in memory and then saved to disk
- You must call Close Excel when done to release resources
Tips
- Use Overwrite If Exists: true for automated processes that run on schedules
- Include timestamps in file names to avoid conflicts (e.g., "report_2025-01-15_143000.xlsx")
- Ensure the target directory exists before creating the file
- Store the file descriptor in a variable for use throughout your workflow
- Always close the file when done to prevent resource leaks
- Consider using relative paths for portability across environments
- Create files in a temporary directory first, then move them to final location if needed
Related Nodes
- Open Excel - Open an existing Excel file
- Save Excel - Save changes to the file
- Close Excel - Close the file and release resources
- Create Sheet - Add new sheets to the file
- Set Range - Write data to the file