From: "Peña, Botp" Date: 2008-06-30T11:37:24+09:00 Subject: Re: File question From: tekmc@hotmail.com [mailto:tekmc@hotmail.com] # require 'fastercsv' # File.open("file.txt', 'r') do |file| file here is a File object. you can check by printing its class # file.readline # FasterCSV.foreach("#{file}") do |row| if you print "#{file}", you will know why this will not work # end # end again, there are many ways in ruby, eg, given a file, File.open("csv.txt").each do |line| p line end "\"skip this\"\n" "\"123\",\"abc\"\n" "\"456\",\"def\"\n" "\"678\",\"zyx\"\n" #=> # we can skip the first line, and then parse the rest of the lines using fastercsv like, File.open "csv.txt" do |file| file.readline file.each do |line| p FasterCSV.parse_line(line) end end ["123", "abc"] ["456", "def"] ["678", "zyx"] #=> # or you can just plainly open the file using fastercsv, and notifying fcsv that the first line is a header, like, FasterCSV.foreach("csv.txt",{:headers=>:first_row}) do |line| puts line end 123,abc 456,def 678,zyx #=> nil kind regards -botp