ReadExcelFile Activity

Purpose: This activity reads an Excel file and returns its contents as structured data in JSON format. The Excel data is parsed and converted to a JSON structure that can be easily processed in workflows. This is useful for importing data from Excel files into workflows for further processing.

Input Properties

FilePath

The full path to the Excel file to read. This should be a valid path to an existing Excel file (.xlsx or .xls format).

Type: string

Required: Yes

Example: "C:\Data\Workbook.xlsx" or "D:\Reports\Data.xls"

Output Properties

ExcelDataJson

The Excel data as a JSON string. Contains the structured data from the Excel file in JSON format.

Type: string

Note: Returns a JSON string containing the Excel data if successful, or an empty JSON object "{}" if the file path is empty or if an error occurs.

Success

True if the file was read successfully, false otherwise.

Type: bool

Note: Returns false if the FilePath is null or empty, if the file does not exist, if the file cannot be read, or if an error occurs during reading.

Usage Example

Scenario: Read data from an Excel file

Configuration:
- FilePath: "C:\Data\Workbook.xlsx"

Result:
- ExcelDataJson: "{\"Sheet1\": {\"A1\": \"Value1\", \"B1\": \"Value2\"}, ...}"
- Success: true

Scenario: Read from non-existent file

Configuration:
- FilePath: "C:\Data\NonExistent.xlsx"

Result:
- ExcelDataJson: "{}"
- Success: false

Error Handling

Important: The activity handles errors gracefully:

  • If FilePath is null or empty, ExcelDataJson will be set to "{}" and Success will be false
  • If the file does not exist or cannot be read, ExcelDataJson will be set to "{}" and Success will be false
  • If any exception occurs during reading, ExcelDataJson will be set to "{}" and Success will be false
  • The activity does not throw exceptions - errors are indicated by the Success output

Always check the Success output to verify if the file was read successfully before processing the ExcelDataJson data.

Important Notes

  • The FilePath must point to an existing Excel file (.xlsx or .xls format)
  • The file must be accessible and readable - ensure proper file permissions
  • The Excel data is converted to JSON format for easy processing in workflows
  • The JSON structure represents the Excel data with sheet names as keys
  • Use WriteExcelFile to write data back to Excel format
  • Large Excel files may take time to process - consider file size when using this activity

Related Activities