ayoubben
ayoubben

Reputation: 35

Roo::spreedsheet can not open excel file

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.

Upvotes: 0

Views: 890

Answers (1)

Hardik Kanjariya ツ
Hardik Kanjariya ツ

Reputation: 636

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.

Upvotes: 2

Related Questions