# CSV.jl: Write csv row by row

**URL:** <https://discourse.julialang.org/t/csv-jl-write-csv-row-by-row/41593>\
**Category:** General Usage\
**Created:** [June 17, 2020, 1:34pm UTC](https://discourse.julialang.org/t/csv-jl-write-csv-row-by-row/41593 "2020-06-17T13:34:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![altre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/altre/32/17036_2.png) [@altre](https://discourse.julialang.org/u/altre)\
**Post date:** [June 17, 2020, 1:34pm UTC](https://discourse.julialang.org/t/csv-jl-write-csv-row-by-row/41593/1 "2020-06-17T13:34:48Z")

</div>

I have an application which writes a csv as an output but never holds the complete csv in memory.  
I would like to use a library such as CSV.jl to  
a) take advantage of optimizations (CSV.jl is super fast for reading!)  
b) use things like escaping logic

However CSV.jl implements a row by row reading method with CSV.rows but only CSV.write to write a complete file as far as I can see.  
Is there any way to do this?

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [June 17, 2020, 1:43pm UTC](https://discourse.julialang.org/t/csv-jl-write-csv-row-by-row/41593/2 "2020-06-17T13:43:30Z")

</div>

There is an `append` kw arg that you can use to add to an existing file.

See [Home · CSV.jl](https://juliadata.github.io/CSV.jl/stable/#CSV.write)

---

<div class="post-metadata">

**Author:** ![lungben](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lungben/32/12314_2.png) [@lungben](https://discourse.julialang.org/u/lungben)\
**Post date:** [June 17, 2020, 4:11pm UTC](https://discourse.julialang.org/t/csv-jl-write-csv-row-by-row/41593/3 "2020-06-17T16:11:07Z")

</div>

Is this what you are looking for?

[https://github.com/JuliaData/CSV.jl/pull/611](https://github.com/JuliaData/CSV.jl/pull/611)

This PR has been merged into the latest CSV.jl version 0.6.2, but I have not tried it yet.

---

<div class="post-metadata">

**Author:** ![altre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/altre/32/17036_2.png) [@altre](https://discourse.julialang.org/u/altre)\
**Post date:** [June 18, 2020, 1:52pm UTC](https://discourse.julialang.org/t/csv-jl-write-csv-row-by-row/41593/4 "2020-06-18T13:52:38Z")

</div>

The RowWriter does not seem quite what I need. Given a struct implementing the Tables.jl interface it returns an iterator of the strings which would be written to the file.  
The append flag is more in the direction of what I need, although I don’t expect it to be very efficient.

I’ll try the append flag and maybe using a Channel-Tables Interface to insert a row as soon as it is there and write if I find anything good.
