# Link imported items to items you already keep (/use/link-imported-items)

Link each record of a file to an item already in Marfa that one of its columns names, such as a book to the collection on its shelf, and keep those links current when you import again.



A file often names something you already keep in Marfa, such as the shelf each book sits on. `marfa items import --link` turns that column into a link, an [edge](/build/edges), from each imported item to the item its cell names. **You need an import that works,** as [Import a file as items](/use/import-items-from-a-file) shows, and the items to link to already in Marfa: **an import never makes them.**

## Name the column, the link and the item [#name-the-column-the-link-and-the-item]

`--link` takes `HEADER=EDGE_TYPE:TARGET`:

* **`HEADER`** is the file's column, such as `Shelf`.
* **`EDGE_TYPE`** is the kind of link, such as `in-collection`. The [Catalog](/catalog/edges) lists them. Name it as it reads from the imported item to the other one: `parent-of` works, and its other-end name `child-of` is refused.
* **`TARGET`** says how a cell finds the item. A type, such as `core.collection`, matches the item's title, ignoring case. `TYPE/FIELD` matches a field, such as `core.entity.person/email`. `import:TYPE/NAME` matches the key another import gave it.

Here `books.csv` has the Shelf column that [Import a file as items](/use/import-items-from-a-file) left out, and you keep a collection for each shelf. Run the import again with `--link` in place of `--skip Shelf`:

```bash
marfa items import --type core.media.book --as reading-list --match-key "Book Id" \
  --map "My Rating=rating" --link "Shelf=in-collection:core.collection" books.csv --preview
```

Output:

```text
3 items read: 0 new, 2 changed, 1 already as the file says, 0 refused.
The file's columns: Book Id left out, Title to title, Author to author, My Rating to rating, Shelf to links of type in-collection.
Links: 2 to add, 0 to move, 0 to remove.
  line 2 (key "1041")
    in-collection: add a link to 01a24005-d03e-755b-b4da-fa50dfa37fc6, for "Favorites"
  line 3 (key "1042")
    in-collection: add a link to 01a24005-d025-71ba-9e32-6817fb0736ec, for "To read"
Nothing was saved: --preview only shows what would change.
```

Run it without `--preview` to save. **A cell that names no item, or more than one, refuses its record,** and the others are saved:

```text
column "Shelf" finds no core.collection titled "Read in 2025". An import links only to an item that is already there.
```

Make that item in Marfa, or correct the cell, and import again. The column fills a field only when `--map` also sends it to one. Repeat `--link` for more columns, each with an edge type of its own.

## Import the file again [#import-the-file-again]

Run the same command, with the same `--type` and `--as`. **The import changes only the links it wrote,** and never one that you or another program made.

* **A cell that names another item moves the link** to that item.
* **A blank cell leaves the links as they are.** With `--blanks clear`, it removes the ones the import wrote.
* **A link someone changes while the import runs is kept,** and the report names it.

The report lists each link it added, moved or removed. `marfa edges delete <edge-id>` removes a link it added. [Import and export file rules](/reference/import-and-export-files#linking-items) has the full rules.
