Ole :: Storage :: FormatError:OLE2签名无效
我想在我的Rails应用程序中读取一个Excel文件。
这是我打开我的Excel文件并阅读它。
doc = Spreadsheet.open('./try.xls', "r") sheet = doc.worksheet 0 sheet.each do |row| array_rows << row.to_a end
我把它作为一个耙任务。当我尝试阅读这个文件,它会引发一个错误。
Ole::Storage::FormatError: OLE2 signature is invalid
发生什么事? 我该怎么办?
.xls文件必须以EXCEL 2003格式保存。 所以文件 – >另存为从所有格式下拉selectExcel年2003年
这解决了我的问题
在Mac上,我必须将其保存为Excel 97-2004(.xls)才能使其正常工作