'xlrd excel sheet read error "open_workbook() got an unexpected keyword argument 'on_demand'""
I am using xlrd to read cell values from excel sheets. My code follows, it was working fine before but don't know what changed in xlrd package, I am getting the error
"TypeError: open_workbook() got an unexpected keyword argument 'on_demand'"
from xlrd import open_workbook
bench = open_workbook('excelsheet.xls',on_demand=True)
for name in bench.sheet_names():
sheetnew = bench.sheet_by_name(name)
for i in range(0, 13):
for cell in sheetnew.col(i):
print cell.value
bench.unload_sheet(name)
Solution 1:[1]
This solved my issue. Might be helpful for someone.
from xlrd import open_workbook
bench = open_workbook("excelsheet.xls")
for name in bench.sheet_names():
sheetnew = bench.sheet_by_name(name)
for i in range(0, 13):
for cell in sheetnew.col(i):
print cell.value
Solution 2:[2]
pip3 install xlrd==2.0.1
try to do this one
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | addy |
Solution 2 | Haojun Fu |