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

匿名 (未验证) 提交于 2019-12-03 00:51:01

问题:

I want to read an Excel File in my 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 is happening? what should I do?

回答1:

The .xls file must be saved in EXCEL 2003 format. So File-->Save As from All Formats dropdown select the Excel year 2003

This solved my problem



回答2:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!