Skip to content

Commit fb24ccb

Browse files
committed
fix: Work around openpyxl behavior
1 parent d4bd195 commit fb24ccb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

agateexcel/table_xlsx.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ def from_xlsx(cls, path, sheet=None, skip_lines=0, header=True, read_only=True,
7373
rows = []
7474

7575
if read_only and (reset_dimensions or reset_dimensions is None and sheet.calculate_dimension() == 'A1:A1'):
76-
sheet.reset_dimensions()
77-
sheet.calculate_dimension(force=True)
76+
try:
77+
sheet.reset_dimensions()
78+
sheet.calculate_dimension(force=True)
79+
# https://foss.heptapod.net/openpyxl/openpyxl/-/issues/2111
80+
except UnboundLocalError:
81+
pass
7882

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

0 commit comments

Comments
 (0)