我想使用PyExcel打开一个简单的excel文件,这是我的代码
>>import os
>>import pyexcel as pe
>>print('Directory Path=', os.getcwd())
Directory Path= C:\Users\Contacts\My experimentation
>>sheet = pe.get_sheet(file_name="C:/Users/Contacts/My experimentation/Mylist.xlsx")
这是我的Excel文件的名称。 这就是我得到的错误
Directory Path= C:\Users\Contacts\My experimentation
Traceback (most recent call last):
File "C:/Users/Contacts/My experimentation/abc.py", line 5, in <module>
sheet = pe.get_sheet(file_name="C:/Users/Contacts/My experimentation/Mylist.xlsx")
File "C:\Users\AppData\Local\Programs\Python\Python35\lib\site-packages\pyexcel\core.py", line 36, in get_sheet
named_content = sources.get_sheet_stream(**keywords)
File "C:\Users\AppData\Local\Programs\Python\Python35\lib\site-packages\pyexcel\internal\core.py", line 20, in get_sheet_stream
sheets = a_source.get_data()
谁能告诉我我做错了什么?谢谢!
答案 0 :(得分:1)
解决方案可能是尝试安装此插件以支持xls文件格式:
pip install pyexcel-xls
对于xlsx,然后安装pyexcel-xlsx。只需转到脚本文件夹并在那里打开命令窗口并记下命令。希望这会有所帮助。