Skip to content
A library for facilitating the grouping and transformation of tabulated data contained in csv or spreadsheets files.
Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Initial Commit Oct 23, 2019
lib bump to 0.1.2 after updates in gemspec and Gemfile.lock file Nov 23, 2019
.gitignore Initial Commit Oct 23, 2019
.rspec Initial Commit Oct 23, 2019
.rubocop.yml Set required ruby version and add links to docs in readme Nov 23, 2019
.travis.yml Initial Commit Oct 23, 2019
Gemfile Initial Commit Oct 23, 2019
LICENSE Update README Nov 18, 2019
Rakefile Initial Commit Oct 23, 2019
csv_converter.gemspec Set required ruby version and add links to docs in readme Nov 23, 2019

csv_converter Build Status

csv_converter is a library for facilitating the grouping and transformation of tabulated data contained in files such as csv or spreadsheets files. This is not a library for parsing files. There are already plenty of libraries out there for reading and parsing files in different formats.

Instead, this library focuses on the conversion of the data provided in the files. Often times, it is required to cast the text data into a ruby object, perform validations on that data, and map it to the corresponding db tables/models and columns/attributes. This library aims to simplify that process.

For example, given the following csv content:

First Name,Last Name,Make,Model,Year,Color,Purchase Date
First Name Last Name Make Model Year Color Purchase Date
John Smith Ford Mustang 2000 Black 25/01/99
Julian Moore Toyota Yaris 2005 Red 13/04/05
Joe Black Volvo V40 2015 Gold 03/02/16

you might want something like this:

    "owner" => {
      "first_name" => "John",
      "last_name" => "Smith"
    "vehicle" => {
      "make" => "Ford",
      "model" => "Mustang",
      "year" => 2000,
      "color" => "Black",
      "purchase_date" => #<Date: 1999-01-25 ((2451204j,0s,0n),+0s,2299161j)>
    "owner" => {
      "first_name" => "Julian",
      "last_name" => "Moore"
    "vehicle" => {
      "make" => "Toyota",
      "model" => "Yaris",
      "year" => 2005,
      "color" => "Red",
      "purchase_date" => #<Date: 2005-04-15 ((2453476j,0s,0n),+0s,2299161j)>
    "owner" => {
      "first_name" => "Joe",
      "last_name" => "Black"
    "vehicle" => {
      "make" => "Volvo",
      "model" => "V40",
      "year" => 2015,
      "color" => "Gold",
      "purchase_date" => #<Date: 2016-03-02 ((2457450j,0s,0n),+0s,2299161j)>

In this example, each column from the csv has been grouped according to the configuration provided. Also, the data for each column has been converted to the expected data type.

This is performed by csv_converter based on the configuration provided in a .yml file (or a ruby hash) that lookes like this:

    header: First Name
    header: Last Name
    header: Make
    header: Model
    header: Year
    header: Color
    header: Purchase Date
        date_format: "%m/%d/%y"


csv_converter supports more advanced data conversions, processing data based on column position instead of headers and nested records within a column.

Please refer to the wiki page for further instructions and more advanced examples.


Add this line to your application's Gemfile:

gem 'csv_converter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install csv_converter


You can view the csv_converter documentation in RDoc format here:

You can also view the wiki here:

Finally, you can check the Readme and source code here:


Currently, the library is stable. I believe it supports the most common use cases so most likely the code won't be updated very frequently. However, if you have any feature requests or find a bug feel free to open a github issue and I will reply as soon as I can.

  • for feature requests please use the enhancement label.
  • for bugs please use the bugs label.


Bug reports and pull requests are welcome on GitHub at


MIT License. Copyright 2019 Francisco Rojas.

You can’t perform that action at this time.