Im trying to view basic info in an excel file ,like sheet names,etc
from xlrd import open_workbook
book = open_workbook('SampleData.xlsx')
book.sheet_names
However it dosent seem to recognize sheetname, sheet_by_index etc .Below is the error
AttributeError: module 'xlrd.book' has no attribute 'sheet_names'
After reading the documentation Here , I found out that a line in your code is calling a function but it is missing parantheses. That function being sheet_names()
. Just change the following in your code for it to work...
from xlrd import open_workbook
book = open_workbook('SampleData.xlsx')
book.sheet_names() #ADD THE MISSING PARANTHESES HERE
Hope it helps. Happy coding :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.