> For the complete documentation index, see [llms.txt](https://cgps.gitbook.io/data-flo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cgps.gitbook.io/data-flo/reference-guide/import-from-csv-file.md).

# import-from-csv-file

## Description

<mark style="color:purple;">`import-from-csv-file`</mark> *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](https://en.wikipedia.org/wiki/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`:

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

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

### &#x20;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`:

| id | code | name           |
| -- | ---- | -------------- |
| 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.
