How to access cell values ​​faster with openpyxl?

for rownum in range(0, len(self.sheet.rows) ):
   for cell in self.sheet.rows[rownum]:
      print cell.value

I want to access all cell values ​​line by line using openpyxl. Works on code, but too slow. How can I access all cell values ​​faster?

+5
source share
2 answers

If you only read cells from top to bottom and from left to right (like most of us), you can use the "optimized reader" http://openpyxl.readthedocs.org/en/latest/optimized.html , It works pretty fast (with binding to the processor) and has less memory than a regular reader.

Disclaimer: I am the author of openpyxl.

+16

, .

for row in sheet.rows:
    for cell in row:
        print cell.value
+4

All Articles