Document toolboxDocument toolbox

CSV Parser

Description

This unit is a Processor unit type.

This unit parses events containing a correctly formatted CSV.

An event comes in through the in port and the data field content is parsed.
Successful input events are enriched with a new field containing the parse result, and the event is output through the out port.
If an error occurs, the input event is enriched with new fields describing the error and the event is output through the error port.

Configuration

After dragging this unit into the Flow canvas, double-click it to access its configuration options. The following table describes the configuration options of this unit:

Tab

Field

Description

Tab

Field

Description

General

Name

Enter a name for the unit. It must start with a letter, and cannot contain spaces. Only letters, numbers, and underscores are allowed.

Description

Enter a description detailing the scope of the unit.

In field

The name of the input event field containing CSV data.

Separator

The character delimiter to use for separating entries. The default value is ','

Quote character 

The character to use for quoted elements. The default value is '"'

Has header

If set to "on", the first line of the CSV is considered as a header.

Out header field

The name of the output event field containing the header of the CSV. If the CSV does not have a header, this field is empty.

Out data field

The name of the output event field containing the result.

Input ports

Port

Description

Port

Description

in

Events containing a properly formatted CSV to be parsed.

Output ports

Port

Description

Port

Description

out

Outputs events enriched with an extra field containing the parsed CSV.

error

Signals when an error occurred. Outputs input events enriched with standard error fields.

Example

In this example, we want to send a parsed data string from CSV to a new my.app table. 

To do it, we will use a Tick unit to send the following CSV raw data to be parsed:

"Year,Make,Model,Length\n1997,Ford,E350,2.35\n2000,Mercury,Cougar,2.38"

Set the Type as string and turn on As expression.

Then, we will link it to a CSV Parser unit with the following settings:

Finally, we will link its out output port to a Devo sink unit to send the parsed events to a my.app table.

Download this example

You can try this flow by downloading this JSON and uploading it to your domain using the Import option:

Â