python Excel处理错误 [英] python excel processing error
问题描述
我正在使用python处理excel.
我正在使用xlrd模块(版本0.6.1).
I am working on the excel processing using python.
I am using xlrd module (version 0.6.1) for the same.
我是安倍晋三大多数excel文件的提取者,但是对于某些excel文件,它给我的错误是:
I am abe to fetch most of the excel files but for some excel files it gives me error as :
XLRDError: Expected BOF record; found 0x213c
任何人都可以让我知道如何解决此问题吗?
预先感谢.
Can anyone let me know about how to solve this issue?
thanks in advance.
推荐答案
您所拥有的很可能是"XML Spreadsheet 2003(* .xml)"文件... "<!"
aka "\x3c\x21"
(这就是XML流开始)被解释为小尾数0x213c
.
What you have is most probably an "XML Spreadsheet 2003 (*.xml)" file ... "<!"
aka "\x3c\x21"
(which is what XML streams start with) is being interpreted as the little-endian number 0x213c
.
记事本:前两行:
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
您也可以通过使用Excel打开文件,然后单击Save As
并查看显示的文件类型来进行检查.当您在那里时,将其另存为XLS文件,以便您的xlrd
可以读取它.
You can also check this by opening the file with Excel and then click on Save As
and look at the file-type that is displayed. While you are there, save it as an XLS file so that your xlrd
can read it.
注意:此XML文件不是Excel 2007+ XLSX文件. XLSX实际上是一个ZIP文件(以"PK"
开头,而不是"<?"
开头),其中包含一堆XML流.
Note: this XML file is NOT the Excel 2007+ XLSX file. An XLSX is actually a ZIP file (starts with "PK"
, not "<?"
) containing a bunch of XML streams.
这篇关于python Excel处理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!