roo-rb / roo-xls

Roo::Xls add support for legacy Excel file standards to Roo.
MIT License
82 stars 82 forks source link

Roo-xls reads xls file but nil object returned #25

Closed varunagrawal closed 6 years ago

varunagrawal commented 8 years ago
spreadsheet = open_spreadsheet(file)

# This line prints out "Sheet0" which is the correct sheet name
puts spreadsheet.default_sheet

# Prints nil
puts spreadsheet 

# Throws an error that `upto` is not defined on nilClass
# I assume the code fails because of this line 
# https://github.com/roo-rb/roo/blob/master/lib/roo/base.rb#L197
headers = spreadsheet.row(1)

I am using Rails 4.0.13 with Ruby 2.1.0

varunagrawal commented 6 years ago

Any updates on this?

tgturner commented 6 years ago

@varunagrawal can you provide an example spreadsheet?

varunagrawal commented 6 years ago

I am no longer working on that project so I don't have access to the exact spreadsheet to reproduce the bug. I believe we figured out that the server was returning a malformed spreadsheet somehow which Excel was able to fix, but roo-xls was having a hard time with. I will close this issue since I don't know what can be done about it.

brilnius commented 3 years ago

For anyone landing on this issue like me... I had the same problem, the XLSX file had two tabs, the first one being empty. After removing the first empty tab there was no more error.