Sunday, 25 August 2013

Create and append to CSV with ruby

Create and append to CSV with ruby

So I recently had to change to OSX from Ubuntu for work and I'm having
some compatibility issue with my Ruby code. I'm trying to append to a CSV
and if it doesn't exist, one should be created. I've used this code in
Ubuntu and it worked just fine, I have no idea what the problem is.
CSV.open("~/Documents/Endeca/file.csv","a") do |csv|
csv << [Text,Date,Name,id]
end
When I run it now, I get an error that says "No such file or directory."
I'm using ruby 2.0.0 with rvm

No comments:

Post a Comment