Parse CSV/Excel File
Parse CSV and Excel files from file storage and convert them to JSON format
Parse CSV/Excel File
Parse CSV and Excel files from the file storage system and convert them to JSON format. The function automatically detects file type and handles headers, making it easy to process spreadsheet data in workflows.
Technical Name: ParseCSVMFunction
Properties
- Execution Mode: SYNC
- Type: NATIVE
- Category: System Functions
- Function ID:
990807b7-c819-447d-887b-4921390679ac
Input Schema
Required Parameters
| Parameter | Type | Description |
|---|---|---|
fileId | string (uuid) | UUID of the file to parse (must exist in file storage) |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
hasHeader | boolean | Whether the file has a header row (default: true) |
sheetIndex | integer | For Excel files, the sheet index to parse (0-based, default: 0) |
[Image placeholder: ParseCSV function configuration panel]
Input Example
Parse CSV with Headers
{
"fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d",
"hasHeader": true
}Parse CSV without Headers
{
"fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d",
"hasHeader": false
}Parse Excel File (Specific Sheet)
{
"fileId": "b8c0d5e3-4f6g-5b2c-d9e8-8f7g6c5d4e3f",
"hasHeader": true,
"sheetIndex": 1
}Output Schema
| Field | Type | Description |
|---|---|---|
headers | array (string) | Column headers from the first row (only if hasHeader is true) |
rows | array (object) | Array of parsed row objects, where each object contains column names as keys |
Each object in the rows array contains:
- Column names as keys (from headers if hasHeader=true, or "Column1", "Column2", etc. if hasHeader=false)
- Cell values as string values
Output Example
With Headers
{
"headers": ["Name", "Email", "Age"],
"rows": [
{
"Name": "John Doe",
"Email": "john@example.com",
"Age": "30"
},
{
"Name": "Jane Smith",
"Email": "jane@example.com",
"Age": "25"
}
]
}Without Headers
{
"rows": [
{
"Column1": "John Doe",
"Column2": "john@example.com",
"Column3": "30"
},
{
"Column1": "Jane Smith",
"Column2": "jane@example.com",
"Column3": "25"
}
]
}[Image placeholder: Parsed data visualization]
Supported File Types
- CSV files (
.csv,text/csv,text/plain) - Excel files (
.xlsx,.xls,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
How It Works
- File Detection: Automatically detects file type based on MIME type or file extension
- Header Processing:
- If
hasHeader=true: Uses first row as column names - If
hasHeader=false: Generates column names like "Column1", "Column2", etc.
- If
- Data Parsing:
- CSV: Parses using UTF-8 encoding
- Excel: Supports both
.xlsxand.xlsformats, converts cell values to strings
- Data Normalization: All values are converted to strings, missing cells are filled with empty strings
Use Cases
Process Uploaded CSV File
Parse a CSV file uploaded by a user:
{
"fileId": "{{context.uploadedFileId}}",
"hasHeader": true
}Import Data from Excel
Parse a specific sheet from an Excel file:
Start → UploadFile → ParseCSV(sheetIndex: 1) → ForEach(InsertMData) → EndProcess File Without Headers
Parse a file without header row:
{
"fileId": "file-uuid",
"hasHeader": false
}[Image placeholder: Workflow examples]
Excel Sheet Index
For Excel files, use sheetIndex to specify which sheet to parse:
0- First sheet (default)1- Second sheet2- Third sheet- And so on...
Error Handling
File Not Found
{
"error": "Error parsing file: File not found with ID: invalid-uuid"
}Unsupported File Type
{
"error": "Error parsing file: Unsupported file type: application/pdf"
}Best Practices
- Always check fileId exists before parsing
- Set hasHeader correctly to ensure proper column mapping
- For Excel files, verify sheet index exists (0-based)
- Handle empty files gracefully in your workflow
- Validate parsed data before processing further
Related Functions
- Convert JSON to CSV - Convert JSON data to CSV format
- Export Data to CSV - Execute a query and export to CSV
- Loop Through Items - Process parsed rows in a loop