Problem writing file for Excel with spreadsheet
I am trying to write an excel file using Ruby 1.6 version 1.9 for Windows. Everything is going well until I get the book.write statement when I write book.write "c:/spreadsheet/excel-file.xls
I keep getting the following error
No such file or directory - c: /spreadsheet/excel-file.xls
when I run it from ruby console I get errono :: EINVAL Invalid argument. when i check the path i can see that the file was created but although i write it empty
Can anyone tell me what to do?
thanks
a source to share
Don't use windows!
According to http://pullmonkey.com/2008/02/19/errno-einval-invalid-argument/
STDOUT doesn't exist if you run mongrel as a service under windows and the result is errono :: EINVAL.
a source to share
We had the same problem.
require 'rubygems'
require 'logger'
require 'spreadsheet'
require 'stringio'
workbook = Spreadsheet::Workbook.new
worksheet = workbook.create_worksheet
worksheet[0, 0] = "Hello, World!"
ostream = StringIO.new
workbook.write (ostream)
ostream.rewind
File.open("aFile.xls","wb") do |f|
f.write(ostream.read)
end
puts "Done!"
a source to share