From: Brian Candler Date: 2012-05-29T16:53:06+09:00 Subject: Re: faster CSV writing steven gre wrote in post #1062429: > trying to send all the data scraped to csv file > business name, address, phone > i either get all 1 record 1 row or just phone #'s and sometimes nothing > been messing with this for some time, i'm a neub so this is probably > most of the problem > > trying to make it each record row bname,addy,phone This code: FasterCSV.open("test.csv", "w") do |csv| csv << [bname,phone] end opens the file for write, truncates it to zero size if it already exists, and then writes one row consisting of two fields, bname and phone. If you want to write three fields, hopefully the solution is clear. If you want to write multiple rows, then you either open the file for append ("a") instead of write ("w"), or you open the csv file outside of a loop which iterates over the data you want to generate. If you are getting blank fields, then check the source data: puts "bname=#{bname.inspect}" puts "phone=#{phone.inspect}" I suspect you will find that one of these is nil or empty string, in which case the problem is in parsing the data, not in writing it out to the CSV. (Sorry I'm not a Nokogiri user so I can't give you any hints on that part) -- Posted via http://www.ruby-forum.com/.