I try to use openpyxl but I get filenotfounderror for .xlsx file

0 votes
asked Jun 26, 2019 by nicolas londoƱo

I have been trying to get openpyxl working with pycharm but the excel documents appear with a question mark, and when I try to run code it says filenotfounderror

import openpyxl as xl

wb = xl.load_workbook("transactions.xlsx") print(wb)

I expect the output to be the cell values but instead i get this:

Traceback (most recent call last): File "C:/Users/nicol/.PyCharmCE2019.1/config/scratches/excel_work.py", line 3, in wb = xl.load_workbook("transactions.xlsx") File "C:\Users\nicol\PycharmProjects\FirstProject\venv\lib\site-packages\openpyxl\reader\excel.py", line 311, in load_workbook data_only , keep_links) File "C:\Users\nicol\PycharmProjects\FirstProject\venv\lib\site-packages\openpyxl\reader\excel.py", line 126, in init self.archive = _validate_archive(fn) File "C:\Users\nicol\PycharmProjects\FirstProject\venv\lib\site-packages\openpyxl\reader\excel.py", line 98, in _validate_archive archive = ZipFile(filename, 'r') File "C:\Users\nicol\AppData\Local\Programs\Python\Python37-32\lib\zipfile.py", line 1204, in init self.fp = io.open(file, filemode) FileNotFoundError: [Errno 2] No such file or directory: 'transactions.xlsx'

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...