I'm new to Python and a have a problem. I'm trying to import an excel file with pandas and I'm using VS Code.
import pandas as pd
data = pd.read_excel(r'D:\Python\user.xlsx')
print(data)
I already installed xlrd
, but however I get this error:
Traceback (most recent call last):
File "d:\Python\import-excel.py", line 24, in <module>
data = pd.read_excel(r'D:\Python\user.xlsx')
File "D:\Python\venv\lib\site-packages\pandas\util\_decorators.py", line 296, in wrapper
return func(*args, **kwargs)
File "D:\Python\venv\lib\site-packages\pandas\io\excel\_base.py", line 304, in read_excel
io = ExcelFile(io, engine=engine)
File "D:\Python\venv\lib\site-packages\pandas\io\excel\_base.py", line 867, in __init__
self._reader = self._engines[engine](self._io)
File "D:\Python\venv\lib\site-packages\pandas\io\excel\_xlrd.py", line 22, in __init__
super().__init__(filepath_or_buffer)
File "D:\Python\venv\lib\site-packages\pandas\io\excel\_base.py", line 353, in __init__
self.book = self.load_workbook(filepath_or_buffer)
File "D:\Python\venv\lib\site-packages\pandas\io\excel\_xlrd.py", line 37, in load_workbook
return open_workbook(filepath_or_buffer)
File "D:\Python\venv\lib\site-packages\xlrd\__init__.py", line 170, in open_workbook
raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
xlrd.biffh.XLRDError: Excel xlsx file; not supported
Can somebody help me?