Monday, 21 January 2013

ruby/rails csv skip first row

I've been looking for a solution to this problem for ages now.

This question kept popping up when i was searching for how to skip the first line with the CSV / FasterCSV libraries, so here's the solution that if you end up here.
the solution is... CSV.foreach("path/to/file.csv",{:headers=>:first_row}) do |row|
HTH.
CREDIT TO:
http://stackoverflow.com/a/7727809