简体   繁体   English

无法使用xlrd在python中读取.xls文件

[英]Unable to read .xls file in python using xlrd

My Code - 我的代码-

import xlrd
xlrd.open_workbook('H:\DataSync\Projects\CV_Rec\Feed.xls')

Error - 错误-

Traceback (most recent call last):
XLRDError: Unsupported format, or corrupt file: Expected BOF record; found 'PK\x03\x04\x14\x00\x06\x00'
File "D:\ATHENA~1\RELEAS~1\build\ext\noarch/pylib\site-packages\xlrd\__init__.py", line 1545, in getbof
File "D:\ATHENA~1\RELEAS~1\build\ext\noarch/pylib\site-packages\xlrd\__init__.py", line 1539, in bof_error

Can anybody help me with this? 有人可以帮我吗?

OK..I found the problem! 好..我发现了问题! The person from where I got this excel sheet had renamed the original file from 'Feed.xlsx' to 'Feed.xls'. 我从中获得此excel工作表的人已将原始文件从“ Feed.xlsx”重命名为“ Feed.xls”。

This is the reason for the corrupt file. 这是文件损坏的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM