# Import Data

When you have a lot of external data to input at once, it might be easier to organise it in a spreadsheet or use a script. In those cases, you can import the resulting CSV or JSON directly into FrontierNav.

![Importing a CSV that creates new rows for any unmatched names. (Old interface)](/files/-MLhHKqrGMNh6XNnh9Ed)

## Prepare an import

Before trying to import anything, use [Edit Data Tables](/editing-data/data-tables.md) to make sure you have created all the Entity Types and Properties that you plan to import.

You might want to [Changes](/editing-data/making-changes.md#save-changes) in case your import doesn't go to plan or you can [Changes](/editing-data/making-changes.md#rewind-changes).

### Supported File Formats

#### CSV

CSVs are a file format that most spreadsheet software can export to so check your "Save As..." or "Export" options and choose "CSV". You MUST have column headings.

```
Name,Price
Potion,20
Sword,500
```

#### JSON

If you're using scripts, you can export to an array of JSON objects.

```
[
  {
    "name": "Potion",
    "price": 20 
  },
  {
    "name": "Sword",
    "price": 500
  }
]
```

### Prepare relationship data

Often a single spreadsheet column can have multiple values. For example:

<table><thead><tr><th width="189">Enemy</th><th>Item Drops</th></tr></thead><tbody><tr><td>Enemy 1</td><td>Potion, Sword</td></tr><tr><td>Enemy 2</td><td>Potion, Antidote, Sword</td></tr></tbody></table>

It's best to split these spreadsheet columns up before importing them. So you can have "Item Drop 1", "Item Drop 2", "Item Drop 3".

| Enemy   | Item Drop 1 | Item Drop 2 | Item Drop 3 |
| ------- | ----------- | ----------- | ----------- |
| Enemy 1 | Potion      | Sword       |             |
| Enemy 2 | Potion      | Antidote    | Sword       |

You can then apply multiple Relationship setters to combine them under a single Relationship property. Columns with no value will be safely ignored. If you do not want to do this manually, you can use a spreadsheet formula like `SPLIT(B2, ", ")`.

## Start an import

To start an import:&#x20;

1. Go to the table you want to import data to.
2. Click the triple dot dropdown menu on the top right and choose "Import data".
3. Choose a file and you will be presented with a form.

![The default import form](/files/-MLhm4g-xowFoZ_U0Uol)

This form may look complicated at first glance. Essentially the import process will:

1. Go through each row of your data sequentially.
2. **Match** each row to an Entity.
3. **Set** properties on the matched Entity from the given columns.

First select the Entity Type to import into. After that, select the criteria to **match** an Entity to a row in your file. Finally, **set** the matched Entity's properties to columns in that row.

Once you are ready, press the "Import" button. Once you are happy with the import, remember to [Change Requests](/editing-data/change-requests.md#open-a-change-request).

### Create or ignore unmatched entities

If a row does not match any entity, by default it will be **ignored**. You can choose to **create** an Entity instead. However, if doing so, you need to **set** a unique Name property. The import will fail if there is no Name.

### Create or ignore unmatched relationships

If you are **setting** Relationships to an Entity and it does not match an existing Relationship, by default it will be **ignored**. You can choose to **create** a new Relationship instead.

Unlike entities, you do not need a Name to create a Relationship, but a target Entity must **match**. If you want to **create** the target Entity too, you must **match** a unique Name otherwise it will be ignored.

Existing relationships are not removed by default. You can choose to **replace** all existing relationships with the new relationship.

### Handle errors

If a row fails to import, an error will be shown and the import will immediately stop. No changes from the import will be applied.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.frontiernav.net/editing-data/importing-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
