Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: James Gray
RE: Headers on Second Row [ reply ]  
2009-01-03 14:46
Sure. Just use some code like this:

#!/usr/bin/env ruby -wKU

require "rubygems"
require "faster_csv"

open("second_row.csv") do |f|
f.gets # discard first line
FCSV.new(f, :headers => true).each do |row|
# use row here
end
end

__END__

Hope that helps.

James Edward Gray II

By: Richard Selby
Headers on Second Row [ reply ]  
2009-01-02 13:40
Annoyingly, one of our suppliers likes to put header info on the second row, not the first of the CSV they send us.

When reading a file with FasterCSV with the :headers option, can you tell it to ignmore the first line and pay attention to line2 onwards?