Note: cljcsv is no longer maintained as it has moved to Clojure Contrib as data.csv.
Cljcsv is a clojure library for reading and writing comma separated value (csv) files. It is licensed under the Eclipse open source license.
The library has been tested on Clojure version 1.2, 1.2.1 and 1.3-beta1.
If you find bugs or has a feature request please open a ticket on the github issue tracker.
Add
<dependency>
<groupId>cljcsv</groupId>
<artifactId>cljcsv</artifactId>
<version>1.3.1</version>
</dependency>
to your pom.xml
file.
Add [cljcsv "1.3.1"]
as a dependency to your project.clj
.
(use '(com.github.jonase.csv)
'(clojure.java.io))
(with-open [in-file (io/reader "in-file.csv")]
(doall
(read-csv in-file)))
(with-open [out-file (io/writer "out-file.csv")]
(write-csv out-file
[["abc" "def"]
["ghi" "jkl"]]))
See also this introduction
cljcsv supports RFC
4180. Additionally, it is
possible to choose separator and qoute characters. Reading is fast
and lazy. See (doc read-csv)
for available options.
See (doc write-csv)
for available options.