0

So I have a path here which contains many excel files

path = ""
files = os.listdir(path)

for file in files:
    workbook = xlrd.open_workbook(file)

I get this error:

FileNotFoundError: [Errno 2] No such file or directory: 'censo2001 (1).xls'

For reference, the first file in the folder is named 'censo2001 (1)' and it has an .xls extension. What could be the problem?

0

1 Answer 1

2

Try use the full path: open_workbook(path + file)

Sign up to request clarification or add additional context in comments.

2 Comments

Worked! Thank you! What could possibly be the problem?
Your current location is not the file location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.