Is it possible to get an Excel document's row count without loading the entire document into memory?

前端 未结 5 1238
暖寄归人
暖寄归人 2020-12-04 19:09

I\'m working on an application that processes huge Excel 2007 files, and I\'m using OpenPyXL to do it. OpenPyXL has two different methods of reading an Excel file - one \"no

5条回答
  •  青春惊慌失措
    2020-12-04 19:53

    Adding on to what Hubro said, apparently get_highest_row() has been deprecated. Using the max_row and max_column properties returns the row and column count. For example:

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

提交回复
热议问题