# CSV won't read tab separated file

**URL:** https://discourse.julialang.org/t/csv-wont-read-tab-separated-file/111120
**Category:** General Usage
**Tags:** csv
**Created:** [March 4, 2024, 9:21am UTC](https://discourse.julialang.org/t/csv-wont-read-tab-separated-file/111120 "2024-03-04T09:21:15Z")
**Posts on this page:** 4
**Page:** 2

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [March 4, 2024, 4:42pm UTC](https://discourse.julialang.org/t/csv-wont-read-tab-separated-file/111120/21 "2024-03-04T16:42:31Z")

</div>

Zip the csv file and help save the planet.

---

<div class="post-metadata">

### Author: ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)
#### Post date: [March 4, 2024, 4:45pm UTC](https://discourse.julialang.org/t/csv-wont-read-tab-separated-file/111120/22 "2024-03-04T16:45:13Z")

</div>

Line containing:

```julia
360G-ACW-20070816

```

is invalid CSV, description starts with a `"` and doesn’t close the quote:

```julia
     1	31127
     2	360G-ACW-20070816
     3	Shedding Skins
     4	"Shedding Skins project will generate a new body of work from the Selkie myths and stories. Maria Hayes will spend time on Bardsy Island and various other areas in the UK mainly the Celtic countries collating information about Selkies. There will also be some site-specific work on beaches as well as marketing and promotional material produced. Maria will also explore more into the digital realm of mixed media and film to see whether this could be a new avenue for her.
     5	GBP
     6	4916
     7	2007-12-11
     8	2022-04-29 11:42:21.612355+00
     9	4
    10	1
    11	1
    12	22244
    13	13
    14	62
    15	5469

```

are the fields, notice field 4.  
Disabling the quoting option might be a path forward.

After disabling quotes, the whole file parses:

```julia
CSV.read("newex.csv", DataFrame; quoted=false)

```

---

<div class="post-metadata">

### Author: ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)
#### Post date: [March 4, 2024, 5:30pm UTC](https://discourse.julialang.org/t/csv-wont-read-tab-separated-file/111120/23 "2024-03-04T17:30:26Z")

</div>

> [@Dan](#):
>
> `31127`

Thank you, Dan.

I’m not sure how you figured this out. Using `limit`, even with `nthreads=1` doesn’t seem to get me anywhere close to the offending line.

~~My method, which read the file fine, retains the leading " in the resulting field. Doing it properly, your way, doesn’t.~~

---

<div class="post-metadata">

### Author: ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)
#### Post date: [March 4, 2024, 6:06pm UTC](https://discourse.julialang.org/t/csv-wont-read-tab-separated-file/111120/24 "2024-03-04T18:06:09Z")

</div>

I have a different problem.

PS  
obviously, I hadn’t read all the messages 😀

this cycle ends without raising any errors

```julia
for i in 1:nrow(df)
    df[i,:]
    println(i)
end

```

This raise the error: `access to undefined reference`

```julia
for i in 1:nrow(df)
    df[i:i,:]
    println(i)
end
1
2
...
25890
25891
25892
25893
25894
25895
25896
25897
25898
25899
25900
25901
25902
25903
25904
25905
25906
25907
ERROR: UndefRefError: access to undefined reference
                                                                        

julia> df[25908,:]
DataFrameRow
   Row │ id identifier title description currency amount_awarde ⋯
       │ Int64 String String String String String15 ⋯
───────┼────────────────────────────────────────────────────────────────────────────────────
 25908 │ 25872 360G-ACW-20021275 mosaic workshops. #undef GBP 4520 ⋯
                                                                          11 columns omitted

```

```julia
      

julia> df[25908:25908,:]
ERROR: UndefRefError: access to undefined reference

```

another way to see where the problems lie

```julia
using DelimitedFiles
julia> readdlm("newex.txt", '\t')
ERROR: unexpected character ' ' after quoted field at row 25909 column 4
Stacktrace:

```

[Previous page](https://discourse.julialang.org/t/csv-wont-read-tab-separated-file/111120.md?page=1)
