I am running Ruby on Rails on Nitrous
Rails 4.0.1
Ruby 2.0.0p247
I am trying to use the spreadsheet gem and open a file I added to my file system in Nitrous. But spreadsheet needs a file path to the document and the file paths I've tried always come up as
"No such file or directory"
My path I thought I should use is
~/workspace/excel-documents/reports.xls
But that is not working. How do I determine my file path in Nitrous?
EDIT------------------------------------------------------------------------------
Just figured out how to find the file path. Not sure if this should be added to the spreadsheets gem README or not. But I did the following...
Spreadsheet.client_encoding = 'UTF-8'.
require 'spreadsheet'
book = Spreadsheet.open File.absolute_path("excel-documents/report.csv")
sheet1 = book.worksheet 0
last_value = nil
sheet1.each do |row|
last_value = row[0].present? && row[0]
end
File.abosulte_path(). Got lucky on a stack exchange search and found the info on it.
http://www.ruby-doc.org/core-2.1.1/File.html#M000023
But now I'm trying to figure out an OLE2 signature is invalid message. Does any one know how formatting works for csv files in spreadsheets?