Getting Started
Basic Concepts
Tutorials
Advanced Concepts
How-to Guides
Building integration flows
Data transformation
Integration patterns
Developing Components
Components
CRM Components
ERP Components
E-Commerce Components
Basic Components
Utility Components
References
Sailor
Component Descriptor
Covered in this article
Related articles

CSV component


Description

A component to read and write Comma Separated Values (CSV) files.

How works

The component can read the CSV file from a remote URL or from the message attachment. It can also write a CSV file from the incoming events.

Requirements

Environment variables

Component is not using any environment variables.

Credentials

The component does not require credentials to function.

Triggers

Read CSV file from URL

This trigger will fetch the CSV file from a given URL. The address must be accessible to the component. The fetched CSV file will be placed in the attachment part of the outgoing message.

Actions

Read CSV attachment

This action will read the CSV attachment of the incoming message and output a JSON object. To configure this action the following fields can be used:

  • CSV Header - this is a required field. Input the names of headers separated with a comma.
  • Separators - Specify the separator type. Usually it is a comma (,) but values like Semicolon (;), Space ( ), Tab (\t) and Hash (#) are also supported.
  • Skip rows - if you know that the incoming CSV file has certain number of headers you can indicate to skip them. The supported values are None, First row, First two, Dirst three and First four.
  • Data columns - here the values will be added dynamically based on the values in the CSV Header field. Here each data column will be listed with the name, Data Type and the Format to enable further configuration.

Write CSV attachment

This action will combine multiple incoming events into a CSV file until there is a gap of more than 10 seconds between events. Afterwards, the CSV file will be closed and attached to the outgoing message.

As part of the component setup, one must specify the columns of the CSV file. These columns will be published as the header in the first row. For each incoming event, the value for each header will be stringified and written as the value for that cell. All other properties will be ignored. For example, headers foo,bar along with the following JSON events:

{"foo":"myfoo", "bar":"mybar"}
{"foo":"myfoo", "bar":[1,2]}
{"bar":"mybar", "baz":"mybaz"}

will produce the following .csv file:

foo,bar
myfoo,mybar
myfoo,"[1,2]"
,mybar

When columns are added in the UI, you will be presented with an opportunity to provide a JSONata expression per column. If you require number formatting that is specific to a locale, the JSONata expression should handle that concern.

screenshot from 2017-10-17 09-28-04

The output of the CSV Write component will be a message with an attachment. In order to access this attachment, the component following the CSV Write must be able to handle file attachments.