0

I'm trying to open excel file with Roo::Spreadsheet But it does not work.

workbook = Roo::Spreadsheet.open(file)

My file's xls extension.

I can read it only when i open the file on my machine and i save as (.xls).

The thing i can not understand is that my original file is also .xls file.

summary :

original_file.xls

then:

workbook = Roo::Spreadsheet.open(file)

Result: does not work.

then: i open my file with excel, and save as (.xls).

workbook = Roo::Spreadsheet.open(file)

result: IT WORKS

Some help please.

ayoubben
  • 35
  • 1
  • 2
  • 10

1 Answers1

2

You can manually pass the file extension as param, Like as follows :

extension = 'xls'
workbook = Roo::Spreadsheet.open(file, :extension => extension)

This has worked for me.