import-from-csv-file

Description

import-from-csv-file adaptor imports data from a CSV file and converts to a datatable.

The adaptor can ingest data from an input file that uses comma separated values, tab separated values, or other similar formats.

Inputs

file Type: file Required: Yes A file containing Comma-separated values or delimited text.

encoding Type: text Required: No The character encoding of the input file. If unspecified, defaults to utf8.

delimiter Type: text Required: No Character used as column delimiter. Defaults to "," (comma).

newline Type: text Required: No Character used as line separator. If unspecified, defaults to (newline).

trim Type: boolean Required: No Specifies whether to ignore whitespace characters immediately around the separator. If unspecified, defaults to True.

column names Type: list Required: No List of column names to be added. If unspecified, first row of the file will be used as column names.

Outputs

data Type: datatable A datatable containing the imported data.

Examples

Example 1: Default behaviour.

Inputs:

file : country.csv

id, code, name
1, GB, United Kingdom
2, TR, Turkey
3, US, United States

encoding : null (empty)

delimiter : null (empty)

newline : null (empty)

trim : null (empty)

column names : null (empty)

Outputs:

file:

idcodename

1

GB

United Kingdom

2

TR

Turkey

3

US

United States

-> Imported the CSV file country.csv into Data-flo.

Example 2: Import CSV file with a semicolon delimiter.

Inputs:

file : country.csv

id; code; name
1; GB; United Kingdom
2; TR; Turkey
3; US; United States

encoding : null (empty)

delimiter : ; (semicolon)

newline : null (empty)

trim : null (empty)

column names : null (empty)

Outputs:

file:

idcodename

1

GB

United Kingdom

2

TR

Turkey

3

US

United States

-> Imported the CSV file country.csv with semicolon delimiter into Data-flo.

Use Cases

  • Pulling in ‘reports’ that get updated online.

Last updated