How do I use fastercsv to just read the header row and not the whole file?

How do I use fastercsv to just read the header row and not the whole file?

I need to read the header row first and not the whole csv file initially in the web application so I can map the input csv columns to the db columns. Once the mapping is complete, a rake task will than process the whole file. I don’t want to read the whole file to save processing time.

How do I just read the header row only? I am assuming this would give me an array “row” and row[0] will be the first column header, row[1] the second column header, and so on.

Any help would be appreciated.

How do I use fastercsv to just read the header row and not the whole file?

Open the file using FasterCSV's new method, read one line, and bail out.