user13113347
user13113347

Reputation:

Unable to read an excel file in python

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?

Upvotes: 0

Views: 86

Answers (1)

Frank
Frank

Reputation: 1285

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

Upvotes: 2

Related Questions