CSV Formatter component

A utility component that converts the specified array of rows or array of objects into comma-separated values (CSV) format, returning a string. In addition to CSV it also supports tab-separated values (TSV) and arbitrary delimiter-separated values (DSV) formats. This operation is the reverse of CSV Parser.

https://kroki.io/svgbob/svg/eNpT0NPFCfS4FGoUIMA5OEzBLb8oN7GkJLUIIlQDlMWtt4ZLN18hM6-gtEQBGeSXloCE8nVB0sn5OaW5ecUKGABotDpuo9UBd1Ml1Q==

In-ports

input Array
Input data specified as an array of rows (array of arrays of values) or array of objects.

columns Array
An Array of strings that represents the headers of the columns in the resulting CSV file. The order of headers will determine the order of columns in the output data.

Out-ports

output String
String in comma-separated values format.

Overview

This component converts JSON data to a string in comma-separated values format. It also supports tab-separated values (TSV) and arbitrary delimiter-separated values (DSV) formats. These tabular formats are popular with spreadsheet programs such as Microsoft Excel. Tabular formats are often more space-efficient than JSON, which can improve loading times for large datasets.

The input format can be either an array of rows (array of arrays of values) or array of objects. Each row or object will be separated by a newline (\n), and each column within each row will be separated by a comma (,). Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.

You can specify the output format in Settings of the component.

Data examples

An example of array of objects input:

[
{ "Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34" },
{ "Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38" }
]

The same data represented as an array of arrays:

[
["Year", "Make", "Model", "Length"],
["1997", "Ford", "E350", "2.34"],
["2000", "Mercury", "Cougar", "2.38"]
]

These inputs above will produce the following output:

Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38

Settings

Output format

Specifies the output format. Choose from the most common CSV (comma-separated values), TSV (tab-separated values ), or set DSV (delimiter-separated values) to specify custom delimiter.

Delimiter

Custom delimiter symbol. For example, you can format values separated by |, the vertical bar character.

Headings in the first row

Specify if the first row in the input array of arrays includes the headers.

Related

CSV Parser
HTTP
JSON
String