Re: FasterCSV load file to table

JAWspeak
2007-07-25T13:14:41Z

You can use FasterCSV:

data = []
FasterCSV.foreach(''file.csv'') { |row| data << row }
puts data #data is all loaded now in the ''data'' variable

Also,   using the (slower) built in libraries:

CSV::Reader.parse(string) { |row| row.each { |cell| puts cell }}

Both these examples are from the really good O''Reilly book, Ruby
Cookbook

On Jul 25, 5:15 am, Vitali
<vit...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> Have tried this way...
>     data = FCSV.read("C:\\temp_file.csv")
>     csv_output = FasterCSV.generate do |csv|
>         data.each do |dt|
>           csv << dt
>         end
>     end
>
>     table = FCSV.parse(csv_output, :headers => true)
>
> but does it really good way?