CSV actions
This page describes all actions available in Integrations for the CSV component.
Read CSV attachment
This action reads the CSV attachment of the incoming message and outputs a JSON object. To configure this action, the following fields can be used:
-
Emit all messages - This check box configures output behavior of the component. If the option is selected, the component emits an array of messages. Otherwise, the component emits a message per row.
-
CSV Header ( required ) - Input the names of headers separated by commas.
-
Separators - Specify the type of separator used in the CSV file. The supported separate types are:
-
Comma (
,
) which is default, -
Semicolon (
;
), -
Space (
-
Tab (
\t
), and -
Hash (
#
).
-
-
Skip rows - If you are aware that the CSV file has a certain number of header rows, you can specify which of these rows should be skipped using the following supported values:
-
None,
-
First row,
-
First two,
-
First three, and
-
First four.
-
-
Data columns - These values are added automatically based on the values in the CSV Header field. Each data column is listed with its Column name, Data Type and Format to allow further configuration should this be required.
Write CSV attachment
-
Include Headers - This option configures the output behavior of the component. If this option’s value is Yes or no value is chosen (the default behavior), then the header of CSV file is written to an attachment. If this option’s value is No, then the CSV header is omitted from the attachment.
This action combines multiple incoming events into a CSV file until there is a gap of more than 10 seconds between events. Afterwards, the CSV file is closed and attached to the outgoing message.
As part of this component configuration, the columns of the CSV file must be specified.
These columns are published as the header in the first row.
For each incoming event, the value for each header is converted to a string and written as the value for that cell.
All other properties are 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 are 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 requirement.
The output of the Write CSV attachment action is a message with an attachment. To access this attachment, the component following the Write CSV attachment action in the flow must be able to handle file attachments.
Write CSV attachment from JSON Object
-
Include Headers - This option configures the output behavior of the component. If this option’s value is Yes or no value is chosen (the default behavior), then the header of CSV file is written to an attachment. If this option’s value is No, then the CSV header is omitted from the attachment.
-
Separators - Specify the type of separator used in the CSV file. The supported separate types are:
-
Comma (
,
) which is default, -
Semicolon (
;
), -
Space (
-
Tab (
\t
), and -
Hash (
#
).
-
This action combines multiple incoming events into a CSV file until there is a gap of more than 10 seconds between events. Afterwards, the CSV file is closed and attached to the outgoing message.
This action converts an incoming array into a CSV file using the following approach:
-
The header inherits names of keys from the input message.
-
The payload will store data from Values of relevant Keys (Columns).
-
Any undefined values of a JSON object will not be joined to the result set (
{ key: undefined }
). -
Any false values of a JSON Object are represented as an empty string (
{ key: false }
=>""
).
Requirements
-
The inbound message must be a JSON object, enclosed by an 'inputObject' object.
-
The JSON object’s structure is a single-level one (i.e. a 'plain object') without nested levels - structured types
objects
andarrays
are not supported as values. Only primitive types are supported:strings
,numbers
,booleans
andnull
. If the JSON object does not meet these requirements, the following error message is thrown:Inbound message should be a plain Object. At least one of entries is not a primitive type
.
The keys of the JSON object’s input are published as the header in the first row.
For each incoming event, the value for each header is converted to a string and written as the value for that cell.
All other properties are ignored.
For example, headers foo,bar
along with the following JSON events:
{"foo":"myfoo", "bar":"mybar"}
generates the following .csv
file:
foo,bar
myfoo,mybar
The output of the Write CSV attachment from JSON Object action is a message with an attachment. To access this attachment, the component following the Write CSV attachment action in the flow must be able to handle file attachments.
Write CSV attachment from JSON Array
-
Include Headers - This option configures the output behavior of the component. If this option’s value is Yes or no value is chosen (the default behavior), then the header of CSV file is written to an attachment. If this option’s value is No, then the CSV header is omitted from the attachment.
-
Separators - Specify the type of separator used in the CSV file. The supported separate types are:
-
Comma (
,
) which is default, -
Semicolon (
;
), -
Space (
-
Tab (
\t
).
-
This action converts an incoming array into a CSV file using the following approach:
-
The header inherits names of keys from the input message.
-
The payload will store data from Values of relevant Keys (Columns).
-
Any undefined values of a JSON object will not be joined to the result set (
{ key: undefined }
). -
Any false values of a JSON Object are represented as an empty string (
{ key: false }
=>""
).
Requirements
-
The inbound message must be a JSON array of objects, where each object is identical in structure and the entire array is enclosed by an 'inputArray' object.
-
The JSON object’s structure is a single-level one (i.e. a 'plain object') without nested levels - structured types
objects
andarrays
are not supported as values. Only primitive types are supported:strings
,numbers
,booleans
andnull
. If the JSON object does not meet these requirements, the following error message is thrown:Inbound message should be a plain Object. At least one of entries is not a primitive type
.
The keys of the JSON object’s input are published as the header in the first row.
For each incoming event, the value for each header is converted to a string and written as the value for that cell.
All other properties are ignored.
For example, headers foo,bar
along with the following JSON events:
[
{"foo":"myfoo", "bar":"mybar"},
{"foo":"myfoo2", "bar":"1"},
{"bar":"mybar", "baz":"mybaz"}
]
generates the following .csv
file:
foo,bar
myfoo,mybar
myfoo2, 1
mybar
The output of the Write CSV attachment from JSON Array action is a message with an attachment. To access this attachment, the component following the Write CSV attachment from JSON Array action in the flow must be able to handle file attachments.