Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize calls to number_of_columns() in SheetReader.to_array() #26

Merged
merged 1 commit into from Dec 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
optimize calls to number_of_columns() in SheetReader.to_array()
pyexcel-xlsx uses openpyxl which computes this dynamically, which
has a huge performance impact when the number of rows is high.
  • Loading branch information
Ashish Kulkarni committed Dec 20, 2016
commit 844505b953bf60f3fbb4058cb8ca56360021440c
3 changes: 2 additions & 1 deletion pyexcel_io/sheet.py
Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@ def _cell_value(self, row, column):
def to_array(self):
"""2 dimentional representation of the content
"""
num_cols = self.number_of_columns()
for row in irange(self.number_of_rows()):
row_position = self.skip_row(row,
self.start_row,
@@ -71,7 +72,7 @@ def to_array(self):
return_row = []
tmp_row = []

for column in irange(0, self.number_of_columns()):
for column in irange(0, num_cols):
column_position = self.skip_column(column,
self.start_column,
self.column_limit)