# Export CSV | not able to read delimited fields correctly

**URL:** <https://discuss.zetetic.net/t/export-csv-not-able-to-read-delimited-fields-correctly/6314>\
**Category:** Codebook FAQ\
**Created:** [March 12, 2024, 7:59pm UTC](https://discuss.zetetic.net/t/export-csv-not-able-to-read-delimited-fields-correctly/6314 "2024-03-12T19:59:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![evan2048](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/evan2048/32/1961_2.png) [@evan2048](https://discuss.zetetic.net/u/evan2048)\
**Post date:** [March 12, 2024, 7:59pm UTC](https://discuss.zetetic.net/t/export-csv-not-able-to-read-delimited-fields-correctly/6314/1 "2024-03-12T19:59:58Z")

</div>

\*\* Sorry, I could not post images inline

Hello,

I am using codebook 4.5.19 to export in the csv format. I’ve created a record, Item 1, with multiple note fields. One note field value is Item 2

I’m having trouble where Item 2 is returned as two password fields.

The “note” CSV column value is item 3.

You can see Item 2 returned Item 4 with the backslash escaped. This leaves a bare pipe that delimits multiple field values of the same field type.

Can you please tell me if and how the string is parsed to recognize Item 2 as one field?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/2X/d/db074bfb86785e177735f4f0275150dfa9de3456.png)

---

<div class="post-metadata">

**Author:** ![dquander](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@dquander](https://discuss.zetetic.net/u/dquander)\
**Post date:** [March 13, 2024, 12:58pm UTC](https://discuss.zetetic.net/t/export-csv-not-able-to-read-delimited-fields-correctly/6314/2 "2024-03-13T12:58:06Z")

</div>

Hi @evan2048 ,  
Thanks for reaching out to us on discuss. The format updates you are looking for should be located here: [Codebook Help - Import](https://www.zetetic.net/codebook/switch/import/#codebookcsv) . If you run into any other issues, please reach out to us at [support@zetetic.net](mailto:support@zetetic.net)

Regards,  
Don

---

<div class="post-metadata">

**Author:** ![wgray](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/wgray/32/843_2.png) [@wgray](https://discuss.zetetic.net/u/wgray)\
**Post date:** [March 13, 2024, 2:29pm UTC](https://discuss.zetetic.net/t/export-csv-not-able-to-read-delimited-fields-correctly/6314/3 "2024-03-13T14:29:10Z")

</div>

Hi @evan2048,

In addition to the documentation link Don provided, I thought I might try to provide some tips here and try to get a little clarification on your situation, in case you are seeing some bug that we aren’t yet aware of.

First, if you are doing a round-trip of your database using CSV format, from export to import, you should be aware that the import won’t set everything up exactly the same as you had it before. For instance, you may see that some fields on entries aren’t in the order you expect – that’s a limitation of the CSV format. If you are doing this to test a backup and restoration strategy, we would recommend restoring your data via the sync feature instead.

With that out of the way, on to the situation with the pipes!

When there is more than one field on an Entry with the same label, e.g. Password, on export Codebook needs to put these in the same Password column of the CSV. In our Codebook CSV format (which is what Codebook for Windows uses by default), we concatenate them with a pipe | character.

```
password1|password2

```

On import of Codebook CSV, Codebook will then split that value up into two separate Password fields on your Entry.

Now, if you have a field value you are importing that you do _not_ want to be split up this way, so a password with a pipe in it already like so:

```
welcome|123

```

Then you need to escape the `|` character with a backslash, like so:

```
welcome\|123

```

And then on import the resulting field value will be `welcome|123` as intended.

From your post I’m having trouble understanding if what you are seeing reflects what I’ve described here. Is the backslash escape of a pipe character in your fields not working when you import with Codebook for Windows?

---

<div class="post-metadata">

**Author:** ![evan2048](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/evan2048/32/1961_2.png) [@evan2048](https://discuss.zetetic.net/u/evan2048)\
**Post date:** [March 13, 2024, 6:13pm UTC](https://discuss.zetetic.net/t/export-csv-not-able-to-read-delimited-fields-correctly/6314/4 "2024-03-13T18:13:21Z")

</div>

Hi @wgray ,

> Is the backslash escape of a pipe character in your fields not working when you import with Codebook for Windows?

Good question. It does not work when importing.

( I’ve found the order fields are added using the UI affects the order they occur in the | delimited value. So your milage may vary unless you delete and re-add the values to the test entry the same way I did 🙂 )

This test:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/2X/e/e59ce75f2bf58dbbaa2e7b2bfbee7ec497119792.png)

exported:  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/2X/2/22e8ee3aa1061de9f7d9e0e14149d78119ac090c.png)

Imports this way:

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/2X/c/cdb1005ed6ee3a4f325af191de4cba9831b1400e.png)

Perhaps the export did not escape the literal \ in the value and the import sees it as a meta character.

Thanks!
