Skip to content

rackerlabs/csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov Clojars Project

racksec/csv

Utilities for writing lists of maps to CSV files.

Usage

How to use this library is best illustrated with some examples.

(def source-data
  [{"a" "foo" "b" "bar" "c" "baz"}
   {"a" "x" "b" "y" "c" "z"}])

(def formatted-data (racksec.csv/data->csv source-data))
formatted-data
=> [["a" "b" "c"]
    ["foo" "bar" "baz"]
    ["x" "y" "z"]]

(def custom-header ["c" "b" "a"])

(racksec.csv/data->csv source-data custom-header)
=> [["c" "b" "a"]
    ["baz" "bar" "foo"]
    ["z" "y" "x"]]

(racksec.csv/write-csv! "mydata.csv" formatted-data)
(slurp "mydata.csv")
=> "a,b,c\nfoo,bar,baz\nx,y,z\n"

License

Copyright © 2016 Rackspace Hosting, Inc.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Clojure utilities for writing lists of maps to CSV files

Resources

License

Stars

Watchers

Forks

Packages

No packages published