Introduction to the extcsv package, which provides a comfortable usage of csv-like files

The Problem

From many sources you can get csv-like datasets: all kinds of measurement systems, webservices, spreadsheets or a scope ...

You can do it the fast way and use a spreadsheet software. But the problem is: What do you do, if the format slightly changes?

Macros tend to break down. And even if the macro language is your best friend, the fancy preformatting facilities will catch you. Not to mention the problem of number notation depending of the language of your intallation. Then a full featured scripting language comes in handy.

So What is This About?

The extcsv library provides methods for easy navigation through the datasets by selectBy. This method accepts multiple keys (which are treated as columns names) and values or comparison operators for values. Additionally regular expressions can be used as selection criteria.
Additionally datasets can be accessed by the [] operator know from Ruby arrays.

Splitting: ExtCsv objects can be splitted by the different values of one or more columns (split)

Iteration: With the Enumerable module included, all its searching/traversal methods can be used. The specific each_by and each_obj methods make it possible to iterate over the differrent values of a column or over subobjects, where these different values are constant.

Comparison: Through the Comparable module ExtCsv objects can be compared or sortet.

Combination: Objects from files with the same structure can easily be concatenated with concat. For differential structured object, the combine method can do simple merging.

For more inforamtion, please have a look at the rdoc documention and the test files.

Plotting is still under developement. It will be done with gnuplot.


For the basic stuff, Ruby is the only requirement. For plotting (which will be included soon), gnuplot and it’s gem have to be installed.
Gnuplot was choosen, because it is available for many platforms and operating systems. For windows systems, a simple MSExcel-export will be implemented.


You have suggestions, feature requests, ideas, diffs, criticsm? GREAT!

Drop me a line {stark.dreamdetective(-,-)} and I will answer as soon as possible.