Reputation: 83
I'm getting attribute error while trying to get the row count in the excel sheet.I have used openpyxl library in python
This is python 3x version and openpyxl latest version used
import openpyxl from openpyxl import load_workbook wb=load_workbook("automation-book-example.xlsx")
ws=wb.get_sheet_by_name('Sheet1')
print(ws.get_highest_row())
Traceback (most recent call last): File "C:\Users\kamaraj\Desktop\python-excel\openpyxl\automation-book-example.py", line 9, in print(ws.get_highest_row()) AttributeError: 'Worksheet' object has no attribute 'get_highest_row'
Upvotes: 0
Views: 10905
Reputation: 41
The get_highest_row() method has been deprecated, you can get the highest row or column by calling the max_row or max_column properties of the worksheet.
ws=wb.get_sheet_by_name('Sheet1')
print(ws.max_row)
Upvotes: 4