Ask coding questions

← Back to all posts
Import excel file with xlrd error
cecchimatteo (0)

Hello everyone,

I am a beginner in python, and I have the following (embarassing) issue:

I am trying to import an excel file using xlrd but I have the "FilenotfoundError".

Anyone is able to help a newbie?

Thanks a lot,

import xlrd

#load the data file
path =(r"C:\Users\MCECCHI\Desktop\oil_exxon.xls")

wb = xlrd.open_workbook(path)
sheet = wb.sheet_by_index(0)


Answered by VulcanWM (2770) [earned 5 cycles]
View Answer
VulcanWM (2770)

If that file is saved to your computer, it won't work.
Try uploading the excel file to Replit.

OldWizard209 (1544)

You don't need to do all of that. You can't import an xl spreadsheet directly to a python repl. You have to convert it into csv. So go to the xl file you want to import and save it as `CSV, there should be an option there. After that, you can upload the file directly into you repl. And because you will be dealing with CSV, it is best to use Jupyter and pandas. it is a better data visualizer.

cecchimatteo (0)

Thanks to the both of you for your comments - everything is clear now! :)