I have this code:
import xlrd
path = "C:\\Users\\m.macapanas\\Desktop\\OFCCP_Default_Values.xlsm"
excel_workbook = xlrd.open_workbook(path)
excel_worksheet = excel_workbook.sheet_by_index(0)
#Read from Excel Worksheet
print("Your Worksheet has " + str(excel_worksheet.ncols) + " columns")
print("Your Worksheet has " + str(excel_worksheet.nrows) + " rows")
for row in range (excel_worksheet.nrows):
for col in range(excel_worksheet.ncols):
print(excel_worksheet.cell_value(row, col), end='')
print('\t', end='')
print()
Then the result is error
Traceback (most recent call last): File "C:/Users/m.macapanas/IdeaProjects/OFCCP Tool/Read Excel File with Python/Pandas.py", line 4, in excel_workbook = xlrd.open_workbook(path) File "C:\Users\m.macapanas\AppData\Roaming\Python\Python36\site-packages\xlrd_init_.py", line 141, in open_workbook ragged_rows=ragged_rows, File "C:\Users\m.macapanas\AppData\Roaming\Python\Python36\site-packages\xlrd\xlsx.py", line 808, in open_workbook_2007_xml x12book.process_stream(zflo, 'Workbook') File "C:\Users\m.macapanas\AppData\Roaming\Python\Python36\site-packages\xlrd\xlsx.py", line 265, in process_stream meth(self, elem) File "C:\Users\m.macapanas\AppData\Roaming\Python\Python36\site-packages\xlrd\xlsx.py", line 392, in do_sheet sheet = Sheet(bk, position=None, name=name, number=sheetx) File "C:\Users\m.macapanas\AppData\Roaming\Python\Python36\site-packages\xlrd\sheet.py", line 326, in init self.extract_formulas = book.extract_formulas AttributeError: 'Book' object has no attribute 'extract_formulas'