1

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?

  • 1
    I can't speak to the CSV question, but Nitrous doesn't run Windows, and thus doesn't support OLE2 at all (unless they have Wine on there and I don't know about it). If that's not the issue, post a new question with the whole error message. – echristopherson Mar 19 '14 at 21:58

0 Answers0