Ole :: Storage :: FormatError: OLE2 signature is not valid.

I want to read an Excel file in a Rails application.

This is how I open my Excel file and read it.

doc = Spreadsheet.open('./try.xls', "r") sheet = doc.worksheet 0 sheet.each do |row| array_rows << row.to_a end 

I have it as a rake task. When I try to read this file, it throws an error.

 Ole::Storage::FormatError: OLE2 signature is invalid 

What's happening? what should I do?

+5
source share
2 answers

The .xls file must be saved in EXCEL 2003 format. So File → Save As from the "All formats" drop-down list, select Excel 2003

This solved my problem.

+6
source

On a Mac, I had to save it as Excel 97-2004 (.xls) to make it work

+1
source

Source: https://habr.com/ru/post/1201121/


All Articles