# FasterCSV question: skip headers

**URL:** <https://rubytalk.org/t/fastercsv-question-skip-headers/56611>\
**Category:** ruby-talk\
**Created:** [13 December 2009 12:24 UTC](https://rubytalk.org/t/fastercsv-question-skip-headers/56611 "2009-12-13T12:24:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thiel\_Chang](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@Thiel\_Chang](https://rubytalk.org/u/Thiel_Chang)\
**Post date:** [13 December 2009 12:24 UTC](https://rubytalk.org/t/fastercsv-question-skip-headers/56611/1 "2009-12-13T12:24:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JEG2](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@JEG2](https://rubytalk.org/u/JEG2)\
**Post date:** [13 December 2009 15:49 UTC](https://rubytalk.org/t/fastercsv-question-skip-headers/56611/2 "2009-12-13T15:49:33Z")

</div>

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 Gray II

> **···**
>
> On Dec 13, 2009, at 6:24 AM, Thiel Chang 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 .

---

<div class="post-metadata">

**Author:** ![Thiel\_Chang](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@Thiel\_Chang](https://rubytalk.org/u/Thiel_Chang)\
**Post date:** [13 December 2009 16:44 UTC](https://rubytalk.org/t/fastercsv-question-skip-headers/56611/3 "2009-12-13T16:44:09Z")

</div>

Hi James,

Thanks for your response. I tried the header option. It worked,.

Kind regards,

Thiel

James Edward Gray II schreef:

> **···**
>
> > On Dec 13, 2009, at 6:24 AM, Thiel Chang 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 .  
> > > &nbsp;&nbsp;&nbsp;&nbsp;  
> > > 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 Gray II
