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

Wrong freeze panes in some excel files #50

Open
andresarpi-lamten opened this issue Apr 1, 2024 · 1 comment
Open

Wrong freeze panes in some excel files #50

andresarpi-lamten opened this issue Apr 1, 2024 · 1 comment

Comments

@andresarpi-lamten
Copy link

if self.sheet_view.pane is not None:

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.

@andresarpi-lamten
Copy link
Author

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}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant