Skip to main content Skip to footer

CSV Reader Documentation

Version: 5.0.2

Retrieved: 2025-10-09 15:15:48


CSV Reader

This module reads lines in a CSV file and sends messages for each line that has been read from the file.

Settings

Name Requirements Purpose Default
File String 0 to 64 in length The file to read. If specified this path will be used. Otherwise the property file is assumed to exist in the incoming message and used, ``
Target Property String 1 to 64 in length The property that will contain the CSV data. data
Treat first line as column header Boolean Whether the first line is treated as column header and used as property name for output messages. true
Number of lines to read Integer Max number of lines to read. Leave empty if all lines should be read. ``
Delimiter String 1 in length The delimiter to use when splitting the rows. ,
Quote Char String 1 in length The char used to quote strings "
Auto Convert Boolean Will make a best effort to convert the value into the best data type. true
Ignore Blank Lines Boolean Will ignore empty rows. true
Skip Rows String 0 to 64 in length Optional way for ignoring rows that starts with a specific value. ``
Trim Options   Optionally trim whitespace before and after values. Trim
Keep Properties Boolean If true the result will be added to the incoming data, otherwise the result will be sent as a new message. true

Input

Any message will trigger a read operation. If the File setting is left empty the filename must be provided on the file property.

Output

There will be one output message per row in the file. If a header line is used each message will contain properties with each column name and the corresponding values. If a row has less values than the number of columns in the header the remaining columns will be assigned an empty string. If a row has more values than the number of columns in the header, the extra values will be ignored. If there are duplicate column names in the header, only the last of these columns will be present in the output. If no header line is used the output messages will have properties called field1, field2..., corresponding to each of the columns. If Keep Properties is enabled the CSV data will be added to the incoming message, otherwise a new message with only the CSV data is output.

Example 1 - Three line CSV with comma(,) delimiter and file as input property

This example will read lines from a CSV file containing three lines. As the first line is treated as header line there will be two messages sent from the module.

# CSV file demo2.csv:
1st col,2nd col,3rd col
Row1 val1,Row1 val2,Row1 val3
Row2 val1,Row2 val2,Row3 val3

# Settings:
File=
Target Property=csvRow
Treat first line as column header=true
Number of lines to read=
Delimiter=,

# Incoming message:
{
    "file": "./data/files/demo2.csv"
}

# Outgoing message (1):
{
  "file": "./data/files/demo2.csv",
  "csvRow": { "1st col": "Row1 val1", "2nd col": "Row1 val2", "3rd col": "Row1 val3" }
}

# Outgoing message (2):
{
  "file": "./data/files/demo2.csv",
  "csvRow": { "1st col": "Row2 val1", "2nd col": "Row2 val2", "3rd col": "Row2 val3" }
}