NeoCSV

is an elegant and efficient standalone Smalltalk framework to read and write CSV converting to or from Smalltalk objects. github

A chapter in the Enterprise Pharo book is a good introduction to NeoCSV.

Go ahead and read the NeoCSV paper. github

# Creating Objects

In many cases you will probably want your data to be returned as one of your domain objects. It would be wasteful to first create arrays and then convert all those. NeoCSV has non-intrusive options to create instances of your own classes and to convert and set fields on them directly. This is done by specifying accessors and converters. Here is an example for reading Associations of Floats.

(NeoCSVReader on: '1.5,2.2\4.5,6\7.8,9.1' withCRs readStream) recordClass: Association; addFloatField: #key:; addFloatField: #value:; upToEnd

recordClass: anObject "Set the object class to instanciate while reading records. Unless the objets are integer indexable, you have to specify fields as well." recordClass := anObject