0

Hello,
I recently started writing a small program for reading multiple xls files from one directory.
While reading one file like this,works perfectly:

wb = xlrd.open_workbook("C:\\path\\FileName.xls")
    sh = wb.sheet_by_index(0)

this one doesn't:

os.chdir("C:\\path")
for fileName in os.listdir("."):
    wb = xlrd.open_workbook(fileName)
    sh = wb.sheet_by_index(0)

I keep getting the same error:
XLRDError: Expected BOF record; found 0x614d
I have no idea what I am doing wrong, please help.

2
Contributors
2
Replies
6
Views
6 Years
Discussion Span
Last Post by Evicake
0

No, there were only .xls files in folder. Anyway because all the files had the same name and only numbers at the end of it were different i just did this, silly solution but it worked:

for y in numbers:
wb = xlrd.open_workbook("C:\\path\\FileName" + str(y)+ ".xls")

numbers is a list containing all numbers that appear in file names.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.