Open Excel
Opens an existing excel file or creates a new one.
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 the ContinueOnError property is True, no error is caught when the project is executed, even if the Catch node is used.
Input
- Excel File Path - The full path of the excel file to open.
Output
- Excel File Descriptor - The ID of the opened excel file.
Options
- Create If Not Exists - Determines whether or not to create a new excel file if it does not exist.
- Password - Encrypted Excel password
How It Works
- Validates Input: Checks that the file path is provided and not empty
- Checks File Type: Verifies the file extension (.xls, .xlsx, .xlsm, .xlam, .xltm, .xltx)
- Handles Legacy Format: If .xls file, converts it to .xlsx format automatically
- Processes Password: If credentials are provided, retrieves password from vault or uses provided password
- Opens File: Attempts to open the Excel file with or without password
- Creates If Missing: If file doesn't exist and Create If Not Exists is true, creates a new file
- Generates Descriptor: Creates a unique file descriptor for the opened Excel file
- Sets Active Sheet: Activates the first sheet at cell A1
- Returns Descriptor: Outputs the file descriptor for use in subsequent Excel operations
Requirements
- A valid file path must be provided
- The file must have a supported extension (.xls, .xlsx, .xlsm, .xlam, .xltm, .xltx)
- For password-protected files, correct credentials must be provided
- Read permissions are required for the file
- If Create If Not Exists is false, the file must already exist
Error Handling
| Error Code | Description | Solution |
|---|---|---|
| Core.Excel.Open.ErrOnCreate | Configuration parsing failed | Check node configuration is valid |
| Core.Excel.Open.ErrOnMessage | Message parsing failed | Verify input message format |
| Core.Excel.Open.ErrPath | File path is empty | Provide a valid file path |
| Core.Excel.Open.ErrCredentials | Invalid credentials or vault configuration | Check password/vault settings are correct |
| Core.Excel.Open.ErrOpenFile | File doesn't exist, unrecognized extension, or file is corrupted | Verify file exists and has valid extension |
| Core.Excel.Open | General open error | Check file permissions and format |
Usage Examples
Example 1: Open Existing File
Open an Excel file for reading or modification:
- Open Excel:
- Excel File Path: "C:/Data/sales_report.xlsx"
- Create If Not Exists: false
-> fileDescriptor
- Get Range (fileDescriptor, "A1:C10") -> data
- Close Excel (fileDescriptor)
Example 2: Open or Create File
Open a file, creating it if it doesn't exist:
- Open Excel:
- Excel File Path: "Reports/monthly_report.xlsx"
- Create If Not Exists: true
-> reportFile
- Set Range (reportFile, "A1:B1", ["Month", "Sales"])
- Save Excel (reportFile)
- Close Excel (reportFile)
Example 3: Open Password-Protected File
Open an Excel file with password from vault:
- Open Excel:
- Excel File Path: "Confidential/secure_data.xlsx"
- Create If Not Exists: false
- Password: [Select from Vault]
-> secureFile
- Get Range (secureFile, "A1:Z100") -> sensitiveData
- Close Excel (secureFile)
Example 4: Process Legacy XLS File
Open and work with an old .xls format file:
- Open Excel:
- Excel File Path: "OldData/legacy_file.xls"
- Create If Not Exists: false
-> legacyFile
- Get Range (legacyFile, "A1:E50") -> oldData
- Create Excel -> newFile
- Set Range (newFile, "A1", {{oldData}})
- Save Excel (newFile, "ConvertedData/new_file.xlsx")
- Close Excel (legacyFile)
- Close Excel (newFile)
Usage Notes
- The Open Excel node automatically converts .xls files to .xlsx format in memory
- If Create If Not Exists is true and the file doesn't exist, a new blank Excel file is created
- The file descriptor must be stored in a variable for use in subsequent Excel operations
- The first sheet in the workbook is automatically activated at cell A1
- Supported formats: .xls, .xlsx, .xlsm (macro-enabled), .xlam, .xltm, .xltx
- For password-protected files, you can use vault credentials or provide password directly
- The file remains open until explicitly closed with Close Excel node
- Multiple files can be opened simultaneously with different descriptors
Tips
- Always store the file descriptor in a variable for later use
- Use Create If Not Exists: true for automated processes that may run before files are created
- Close files as soon as you're done to free system resources
- For password-protected files, use vault credentials instead of hardcoding passwords
- When working with legacy .xls files, consider saving them as .xlsx for better compatibility
- Check file exists before opening if Create If Not Exists is false to handle errors gracefully
- Use absolute paths for reliability, or relative paths for portability
- Remember that opening doesn't lock the file - other processes can still modify it
Related Nodes
- Create Excel - Create a new Excel file
- Close Excel - Close an opened file
- Save Excel - Save changes to file
- Get Sheets - List sheets in opened file
- Switch To Sheet - Change active sheet