> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/import-tool/import-configuration-examples/csv-example.md).

# Importing Using CSV

Create a File connection, upload a sample CSV, map fields, and import records into Emporix.

This walkthrough uses connection and stream **Vendor Import**, sample file `vendors-sample.csv`, key column `vendorId`, and target type `DEMO_VENDOR`. Replace the file, key column, and target type with your own feed when you import production data.

{% hint style="info" %}
Complete the Emporix [Prerequisites for the Import Tool](https://developer.emporix.io/import-tool/import-setup-and-jobs/prerequisites.md) first. Create a custom entity type and mixin for `DEMO_VENDOR` with attribute keys that match the columns you want to map, for example `VendorName`, `vendorCountry`, `Status`, and `ID`. To let the first import create the type and mixin from the CSV instead, see [Importing Custom Entities with Auto-Mapping](https://developer.emporix.io/import-tool/import-configuration-examples/auto-mapping-custom-entities.md). For the general UI procedures, see [Connections](https://developer.emporix.io/import-tool/import-setup-and-jobs/connections.md), [Imports](https://developer.emporix.io/import-tool/import-setup-and-jobs/imports.md), and [Streams](https://developer.emporix.io/import-tool/import-setup-and-jobs/imports/streams.md).
{% endhint %}

## Source file requirements

The feed must be a delimited text file that the Import Tool can store and read.

For this example, you use the sample vendor CSV file. When you upload your own file, make sure it:

* Uses **CSV (delimited text)** with a header row and a stable key column, for example `vendorId`
* Fits under the environment upload limit shown on the stream **Files** tab, or is published at an HTTP(S) URL for the connection **File URL**
* Uses a column separator and character encoding that match the connection and stream **File format** settings

{% file src="/files/4aLWmYBYTS7gMTJ3ojMG" %}

```csv
vendorId,vendorName,country,status
V-1001,Nordic Living,DE,ACTIVE
V-1002,Luma Lighting,PL,ACTIVE
V-1003,ProSpace Storage,FR,ACTIVE
V-1004,Alpine Tools,AT,ACTIVE
V-1005,Coastal Parts,NL,INACTIVE
```

The columns are later mapped to the related mixin schema:

| Column       | Role in this example                            |
| ------------ | ----------------------------------------------- |
| `vendorId`   | Stream **Key field** and mapped to mixin **ID** |
| `vendorName` | Mapped to mixin **VendorName**                  |
| `country`    | Mapped to mixin **vendorCountry**               |
| `status`     | Mapped to mixin **Status**                      |

## Create a File connection

Follow [Create a connection](https://developer.emporix.io/import-tool/import-setup-and-jobs/connections.md#create-a-connection) and [File](https://developer.emporix.io/import-tool/import-setup-and-jobs/connections.md#file). For this example, use:

* **Name** – `Vendor Import`
* **Source type** – **File**
* **File format** – **CSV (delimited text)**
* **File URL** – leave empty when you upload files on the stream
* **Column separator** – **Comma ( , )**
* **Character encoding** – **UTF-8**
* **Authentication** – **None**

Choose **Save**, then upload `vendors-sample.csv` as the **Sample file**. The sample supplies the column names for keys and field mapping.

<figure><img src="https://2637457592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9VS91qn3Ylwd58YivX1A%2Fuploads%2Fgit-blob-3712d6cd710f3fe674cdfc0cb69e7b2ec13ed253%2Fit_csv_connection.png?alt=media" alt="New Connection dialog for File with CSV format and sample file" width="500"><figcaption><p>New File connection with CSV format, File URL, sample file, and encoding</p></figcaption></figure>

## Create a stream from the File source

{% stepper %}
{% step %}

#### Create the import and stream

Create an import if you do not have one yet, then create a stream with:

* **Name** – `Vendor Import`
* **Connection** – **Vendor Import**
* **Source record** – `vendors-sample.csv` (the sample uploaded on the connection)
* **Key field** – `vendorId`
* **Target** – `emporix.customEntity`
* **Target type** – `DEMO_VENDOR`

Choose **Save**.

<figure><img src="https://2637457592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9VS91qn3Ylwd58YivX1A%2Fuploads%2Fgit-blob-33505f9fc8135fc8e18f794f73e9bf88f28f1534%2Fit_csv_stream_creation.png?alt=media" alt="New Stream dialog for Vendor Import with CSV source record and DEMO_VENDOR" width="500"><figcaption><p>New Stream for a File connection with source record, key field, and target type</p></figcaption></figure>
{% endstep %}

{% step %}

#### Set how each file is read

Expand the stream and open the **Target** tab. Under **Each file contains**, choose **Everything (a full export)** when every file is a complete picture, or **Only what changed** when each file is a change set. Choose **Save**.
{% endstep %}

{% step %}

#### Confirm the file format

Open the **File format** tab. Confirm **Column separator**, **Character encoding**, and **Rows to skip** for this feed. Choose **Save**.
{% endstep %}

{% step %}

#### Queue a CSV file

Open the **Files** tab. Drop a CSV file onto the drop zone, or select **Choose a file**. The file appears under **Waiting to import**. The sample file on the connection is not enough for a run; the stream imports only files you queue here. Uploading does not start the import; the next run of the job reads the queue.

<figure><img src="https://2637457592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9VS91qn3Ylwd58YivX1A%2Fuploads%2Fgit-blob-cb18066860c4a042f0ce1429edb7aabd321d4551%2Fit_csv.png?alt=media" alt="Files tab with CSV upload drop zone and already imported history"><figcaption><p>Files tab with CSV upload and import history</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## Map and publish fields

On the stream row, choose **Edit mapping**. Choose **Map from source** so source column names match mixin **Key** values where they align. Add or adjust rows for this example as follows:

| Source field | Target field    | Target type |
| ------------ | --------------- | ----------- |
| `vendorName` | `VendorName`    | TEXT        |
| `country`    | `vendorCountry` | TEXT        |
| `status`     | `Status`        | TEXT        |
| `vendorId`   | `ID`            | TEXT        |

Choose **Save**, then **Publish** so real runs use the mapping. See [Field Mapping](https://developer.emporix.io/import-tool/import-setup-and-jobs/imports/field-mapping.md).

<figure><img src="https://2637457592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9VS91qn3Ylwd58YivX1A%2Fuploads%2Fgit-blob-5bda338f1e94bc88ac13400572c2b8563235f192%2Fit_csv_mapping.png?alt=media" alt="Field Mapping for Vendor Import with four published CSV column mappings"><figcaption><p>Published field mapping for the Vendor Import stream</p></figcaption></figure>

## Run the CSV import

Confirm that the CSV is under **Waiting to import** on the stream **Files** tab. In the import details view, choose **Dry run** to validate without writing. To import records, open **Run options** and choose the required full or delta mode. See [Running and Monitoring Imports](https://developer.emporix.io/import-tool/import-setup-and-jobs/imports/running-imports.md). For how the queue drains under **Everything (a full export)** versus **Only what changed**, see [Files](https://developer.emporix.io/import-tool/import-setup-and-jobs/imports/configuring-streams.md#files).

After a successful run, the file moves to **Already imported** on the **Files** tab. The same content is refused if you upload it again for that stream.

If the file failed, correct the CSV, then upload the fixed file again on the **Files** tab so it appears under **Waiting to import**. Do not rely on the failed history entry alone; the stream only reads a new upload. See [Re-upload a corrected file](https://developer.emporix.io/import-tool/import-setup-and-jobs/imports/configuring-streams.md#re-upload-a-corrected-file).

<figure><img src="https://2637457592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9VS91qn3Ylwd58YivX1A%2Fuploads%2Fgit-blob-edbbfbe2e3af8a30c751c19633523a28be2ebf00%2Fit_csv_readding_file.png?alt=media" alt="Files tab ready for uploading a corrected CSV after a previous file"><figcaption><p>Files tab used to upload a corrected CSV after a failed import</p></figcaption></figure>

## Review results

{% stepper %}
{% step %}

#### Inspect Imported Data

From the stream actions menu, choose **View imported data**. Each row shows the source **Key** (for example `vendorId:V-1001`), the target **Emporix ID**, **Outcome**, and **Imported At**.

<figure><img src="https://2637457592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9VS91qn3Ylwd58YivX1A%2Fuploads%2Fgit-blob-4907473ad6aea3a4d4f727f8dfde24a43c12d745%2Fit_csv_imported_data.png?alt=media" alt="Imported Data for Vendor Import with vendorId keys and UPSERTED outcomes"><figcaption><p>Imported Data for the Vendor Import stream</p></figcaption></figure>
{% endstep %}

{% step %}

#### Open the DEMO\_VENDOR instances

In **Management Dashboard**, go to **Custom Instances** and open the list for your `DEMO_VENDOR` type. The list shows the imported instances with each record's **Id**, **Name**, and **Created At**.

<figure><img src="https://2637457592-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9VS91qn3Ylwd58YivX1A%2Fuploads%2Fgit-blob-41e7255cc9fbb9ca5872f58a994d594ed668a475%2Fit_csv_result_MD.png?alt=media" alt="Custom Instances list of DEMO_VENDOR records after CSV import"><figcaption><p>Imported `DEMO_VENDOR` instances in Management Dashboard</p></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
To queue files, set load order, or trigger runs through the Import Service API, see [How to import files for a stream](https://developer.emporix.io/api-documentation/api-guides/utilities/import-service/import-service.md#how-to-import-files-for-a-stream) in the Import Service tutorial.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.emporix.io/import-tool/import-configuration-examples/csv-example.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
