Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

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

+3 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'

1 Answer

0 votes
answered Aug 22, 2025 by Jerry Jeremiah (2,040 points)
If you are using OnlineGDB then you need to get the Excel file onto their computer - not yours.
Your code runs on their computer so the excel file has to be there as well.
You can upload files to their server by using the toolbar button with the arrow going to the cloud.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...