# Importing only specific lines from large csv file

**URL:** https://discourse.julialang.org/t/importing-only-specific-lines-from-large-csv-file/108672
**Category:** Data
**Tags:** csv
**Created:** [January 11, 2024, 10:59am UTC](https://discourse.julialang.org/t/importing-only-specific-lines-from-large-csv-file/108672 "2024-01-11T10:59:44Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)
#### Post date: [January 11, 2024, 11:21am UTC](https://discourse.julialang.org/t/importing-only-specific-lines-from-large-csv-file/108672/3 "2024-01-11T11:21:47Z")

</div>

`CSV.jl` has functionality for reading large CSV files in chunks already: [Reading · CSV.jl](https://csv.juliadata.org/stable/reading.html#CSV.Chunks)

To do exactly what you ask, you could e.g. do something like this with `skipto` and `limit`, but using the chunk iterator might be a better solution.

```julia-repl
julia> using CSV

julia> data = """
       a,b,c
       1,2,3
       4,5,6
       7,8,9
       totals: 12, 15, 18
       grand total: 45
       """
"a,b,c\n1,2,3\n4,5,6\n7,8,9\ntotals: 12, 15, 18\ngrand total: 45\n"

julia> file = CSV.File(IOBuffer(data);skipto=3, limit=2)
2-element CSV.File:
 CSV.Row: (var"a,b,c" = String7("4,5,6"),)
 CSV.Row: (var"a,b,c" = String7("7,8,9"),)

```

---

_[View the full topic](https://discourse.julialang.org/t/importing-only-specific-lines-from-large-csv-file/108672)._
