sultan
2009-Aug-05 16:17 UTC
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.
Philip Hallstrom
2009-Aug-05 17:03 UTC
Re: How do I use fastercsv to just read the header row and not the whole file?
On Aug 5, 2009, at 9:17 AM, sultan wrote:> > 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.> 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. > > >