CL-CSV
CL-CSV is a library to parse and write csv (comma-separated-values) files.

  • full test suite
  • tuned (slightly) for performance
  • handles multiline data
  • handles internationalized data
  • interop layer with clsql
  • By default produces CSVs that work with MS Excel
  • documentation

Example:

CL-CSV> (with-input-from-string (s "King,Queen
William,Elizabeth,your mom")
          (read-csv s))
(("King" "Queen") ("William" "Elizabeth" "your mom"))

It also works with its companion library data-tables:

(cl-csv:get-data-table-from-csv #p"file.csv")
;; #<DATA-TABLE:DATA-TABLE {1007639BE3}>

;; or create a data-table object:

(make-instance
   'data-table
   :column-names '("first name" "last name" "job title" "number of hours" "id")
   :rows '(("Russ" "Tyndall" "Software Developer" "26.2" "1")
           ("Adam" "Smith" "Economist" "37.5" "2")
           ("John" "Doe" "Anonymous Human" "42.1" "3")
           ("Chuck" "Darwin" "Natural Philosipher" "17.68" "4")
           ("Bill" "Shakespear" "Bard" "12.2" "5")
           ("James" "Kirk" "Starship Captain" "13.1" "6")))

;; access rows:
 (data-table:rows dt)

;; access columns:
(data-table:data-table-value dt :row row :col-name "job title")

;; etc

For more info see:

Git Hub: https://github.com/AccelerationNet/cl-csv

Here are blog posts giving example usage:

Topics: file format, Text, AccelerationNet, CSV