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 in a sheet row 开发者_高级运维by row with openpyxl. Above code works but too slow. How can I access all cell values faster?
If you're only reading 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 quite fast (CPU bound) and has smaller memory footprint than regular reader.
Disclaimer: I'm the author of openpyxl.
Just hazarding a guess, I think this might be faster.
for row in sheet.rows:
for cell in row:
print cell.value
精彩评论