csvtable

Nim tools for handling CSV files with an API similar to Python\'s CSVDictReader and -Writer

Pure Nim score 30/100 · tests present · docs generated

Summary

Latest Version 0.3.0
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-08-31 07:15

Tags

Authors

  • Axel Pahl

Installation

nimble install csvtable
choosenim install csvtable
git clone https://github.com/apahl/csvtable

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
csvtable - - - - - - -

Dependencies

Package Version Optional
nim >= 0.18.1 No

Source

Repository https://github.com/apahl/csvtable
Homepage https://github.com/apahl/csvtable
Documentation View Documentation
Registry Source nimble_official

README

csvtable nimble

Tools for handling CSV files (comma or tab-separated) with an API similar to Python's CSVDictReader and -Writer. The values in the rows are assigned to tables as values where the keys are the corresponding headers.

Please note: version 0.3.0 changes the API, have a look at the example and the doc. For the old API. use releases <0.3.0.

Example usage

  import csvtable, strutils
  var
    csvIn = newCSVTblReader("test.csv")
  echo csvIn.headers
  let
    headersOut = @["position", "total"]  # all headers must be known at the creation of the file
  var csvOut = newCSVTblWriter("tmp.csv", headersOut)
  for dIn in csvIn:
    var dOut = newTable[string, string]()
    dOut["position"] = dIn["position"]
    dOut["total"] = $(dIn["day1"].parseInt + dIn["day2"].parseInt)
    csvOut.writeRow(dOut)
  csvOut.close

Limitations

This is a very simple implementation of a CSV parser. It currently does not support quoted strings.

Installation

nimble install csvtable

Documentation

Run nimble gendoc. Documentation can then be found in doc/csvtable.html.