Search code examples
python-3.xopenpyxlattributeerror

Python 3.5.2 , openpyxl v 2.4.1 ,get_highest_row() , AttributeError


I'm new to Python,while I'm facing a problem with opening an Excel file with openpyxl Module.I'm Running openpyxl V2.4.1 on Python 3.5.2 on Windows.Here is a small part of my Code.I'm getting the Following Error.

This is the Error I'm getting:

enter image description here

Please Help me to Solve this,finding a Way to get Maximum number of Rows and Columns in a Sheet.

If I have to change my openpyxl Module version,please describe!

Thanks in advance.

WorkBook = openpyxl.load_workbook("G:\\Python_Created\\DS.xlsx")
#I have a Sheet named "Original" in my Excell Workbook
Sheet = WorkBook.get_sheet_by_name("Original")
Sheet.get_highest_row()

Solution

  • Check out enigmas answer

    wb = load_workbook(path, use_iterators=True)
    sheet = wb.worksheets[0]
    
    row_count = sheet.max_row
    column_count = sheet.max_column