Hi ,
I am refactoring a class that’s using Fastercsv to read a csv file. How
do I skip the first (header) line. Now I’m using a helpvariable
skipHEADER
but I want a more elegant solution .
Kind regards,
Thiel
Hi ,
I am refactoring a class that’s using Fastercsv to read a csv file. How
do I skip the first (header) line. Now I’m using a helpvariable
skipHEADER
but I want a more elegant solution .
Kind regards,
Thiel
On Dec 13, 2009, at 6:24 AM, Thiel C. wrote:
I am refactoring a class that’s using Fastercsv to read a csv file. How do I skip the first (header) line. Now I’m using a helpvariable skipHEADER but I want a more elegant solution .
If I understand the question correctly, I would recommend setting
:headers => true as a FasterCSV option. This will cause it to read the
headers in the first row, but not return them. You can then refer to
columns by name, instead of by number.
Hope that helps.
James Edward G. II
Hi James,
Thanks for your response. I tried the header option. It worked,.
Kind regards,
Thiel
James Edward G. II schreef:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs