cl-csv

API Reference

cl-csv

Facilities for reading and writing CSV format files

CL-CSV

  • Variable *QUOTE*
    #\"
    Default quote character
  • Variable *SEPARATOR*
    #\,
    Default separator character
  • Variable *QUOTE-ESCAPE*
    nil
    Default setting for escaping quotes - by default this is a vector of #(*quote* *quote*)
  • Variable *ENABLE-SIGNALS*
    nil
    Should the reading and writing process enable filtering signals
  • Condition CSV-PARSE-ERROR  (ERROR)
  • Function CSV-PARSE-ERROR (msg &rest args)
  • Condition CSV-DATA-READ
  • Function CSV-DATA-READ (data &key csv-reader)
  • Condition CSV-ROW-READ
  • Function CSV-ROW-READ (row &key csv-reader)
  • Generic-Function FORMAT-CSV-VALUE (val)
    Print values in ways that are most cross compatible with the csv format
  • Method FORMAT-CSV-VALUE (val)
  • Method FORMAT-CSV-VALUE (val)
  • Method FORMAT-CSV-VALUE (val)
  • Generic-Function WRITE-CSV-VALUE (val csv-stream &key formatter quote separator escape always-quote)
    Writes val to csv-stream in a formatted fashion. Keywords formatter: used to format val. Defaults to format-csv-value. quote: quoting character. Defaults to *quote* escape: escaping character. Defaults to *quote-escape* newline: newline character. Defaults to *write-newline* always-quote: Defaults to *always-quote*
  • Method WRITE-CSV-VALUE (val csv-stream &key (formatter #'format-csv-value) (quote *quote*) (separator *separator*) (escape *quote-escape*) (always-quote *always-quote*) (newline *write-newline*) &aux (formatted-value (funcall formatter val)) (should-quote (or always-quote (chars-in (list quote separator newline) formatted-value))))
  • Method WRITE-CSV-VALUE (val csv-stream &key (formatter #'format-csv-value) (quote *quote*) (separator *separator*) (escape *quote-escape*) (always-quote *always-quote*) (newline *write-newline*) &aux (formatted-value (funcall formatter val)) (should-quote (or always-quote (chars-in (list quote separator newline) formatted-value))))
  • Method WRITE-CSV-VALUE (val csv-stream &key (formatter #'format-csv-value) (quote *quote*) (separator *separator*) (escape *quote-escape*) (always-quote *always-quote*) (newline *write-newline*) &aux (formatted-value (funcall formatter val)) (should-quote (or always-quote (chars-in (list quote separator newline) formatted-value))))
  • Function WRITE-CSV-ROW (items &key stream ((separator *separator*) *separator*) ((quote *quote*) *quote*) ((escape *quote-escape*) *quote-escape*) ((newline *write-newline*) *write-newline*) ((always-quote *always-quote*) *always-quote*))
    Writes a list items to stream rows-of-items: iterable Keywords: stream: stream to write to. Default: nil. quote: quoting character. Defaults to *quote* escape: escaping character. Defaults to *quote-escape* newline: newline character. Defaults to *write-newline* always-quote: Defaults to *always-quote*
  • Function WRITE-CSV (rows-of-items &key stream ((separator *separator*) *separator*) ((quote *quote*) *quote*) ((escape *quote-escape*) *quote-escape*) ((newline *write-newline*) *write-newline*) ((always-quote *always-quote*) *always-quote*))
    Writes a csv to the given stream. rows-of-items: iterable Keywords: stream: stream to write to. Default: nil. nil - writes the rows to a string and returns it an open stream a pathname (overwrites if the file exists) quote: quoting character. Defaults to *quote* escape: escaping character. Defaults to *quote-escape* newline: newline character. Defaults to *write-newline* always-quote: Defaults to *always-quote*
  • Variable *DEFAULT-EXTERNAL-FORMAT*
    :default
    the external format used for opening files
  • Function READ-CSV-SAMPLE (stream-or-string sample-size &key row-fn map-fn skip-first-p ((separator *separator*) *separator*) ((quote *quote*) *quote*) ((escape *quote-escape*) *quote-escape*) ((unquoted-empty-string-is-nil *unquoted-empty-string-is-nil*) *unquoted-empty-string-is-nil*) ((quoted-empty-string-is-nil *quoted-empty-string-is-nil*) *quoted-empty-string-is-nil*) ((trim-outer-whitespace *trim-outer-whitespace*) *trim-outer-whitespace*) ((newline *read-newline*) *read-newline*))
  • Macro DO-CSV ((row-var stream-or-pathname &rest read-csv-keys) &body body)
    row-var: a variable that is passed into _body_ stream-or-pathname: a stream or a pathname to read the CSV data from read-csv-keys: keys and values passed to the _read-csv_ function body: body of the macro
  • Function READ-CSV-ROW (stream-or-string &key csv-reader ((separator *separator*) *separator*) ((quote *quote*) *quote*) ((escape *quote-escape*) *quote-escape*) ((unquoted-empty-string-is-nil *unquoted-empty-string-is-nil*) *unquoted-empty-string-is-nil*) ((quoted-empty-string-is-nil *quoted-empty-string-is-nil*) *quoted-empty-string-is-nil*) ((trim-outer-whitespace *trim-outer-whitespace*) *trim-outer-whitespace*) ((newline *read-newline*) *read-newline*) ((escape-mode *escape-mode*) *escape-mode*))
  • Function READ-CSV (stream-or-string &rest all-keys &key csv-reader row-fn map-fn data-map-fn sample skip-first-p ((separator *separator*) *separator*) ((quote *quote*) *quote*) ((escape *quote-escape*) *quote-escape*) ((unquoted-empty-string-is-nil *unquoted-empty-string-is-nil*) *unquoted-empty-string-is-nil*) ((quoted-empty-string-is-nil *quoted-empty-string-is-nil*) *quoted-empty-string-is-nil*) ((trim-outer-whitespace *trim-outer-whitespace*) *trim-outer-whitespace*) ((newline *read-newline*) *read-newline*) ((escape-mode *escape-mode*) *escape-mode*))

cl-csv-clsql

Facilities for reading and writing CSV format files (and importing and exporting csvs from databases)

No packages.

cl-csv-data-table

Facilities for converting CSV data to data-tables

No packages.