Open andresarpi-lamten opened 7 months ago
I've tested many excels and this new impl seems to work every time
def get_frozen_pane_from_sheet(sheet):
if not sheet.sheet_view.pane:
return None
row = int(sheet.sheet_view.pane.ySplit) + 1 if sheet.sheet_view.pane.ySplit else 1
column = get_column_letter(int(sheet.sheet_view.pane.xSplit) + 1) if sheet.sheet_view.pane.xSplit else "A"
return f"{column}{row}"
https://github.com/theorchard/openpyxl/blob/b06d737937d6c04927d8cfe9758a78d94c023872/openpyxl/worksheet/worksheet.py#L261
I have been parsing some relatively complex excel files and the freeze_panes property has given me wrong values. However, if I use the:
sheet.sheet_view.pane.xSplit, sheet.sheet_view.pane.ySplit
And add a +1, those are the correct frozen columns/rows. I'm not talking about the format or zero index.
If you need the excel files, I can send them to you privately.