Skip to content

Commit

Permalink
fix: Work around openpyxl behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 7, 2023
1 parent d4bd195 commit fb24ccb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions agateexcel/table_xlsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ def from_xlsx(cls, path, sheet=None, skip_lines=0, header=True, read_only=True,
rows = []

if read_only and (reset_dimensions or reset_dimensions is None and sheet.calculate_dimension() == 'A1:A1'):
sheet.reset_dimensions()
sheet.calculate_dimension(force=True)
try:
sheet.reset_dimensions()
sheet.calculate_dimension(force=True)
# https://foss.heptapod.net/openpyxl/openpyxl/-/issues/2111
except UnboundLocalError:
pass

if header:
sheet_header = sheet.iter_rows(min_row=1 + skip_lines, max_row=1 + skip_lines)
Expand Down

0 comments on commit fb24ccb

Please sign in to comment.