Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to freeze pane in XLWings

Tags:

python

xlwings

I like to check how to freeze panes in XLWings.

Hope anyone familiar with XLWings can assist.

I have tried the below but given an error: pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)

app1 = xw.apps
wb = app1.active.books.active
wb.api.Windows(6).FreezePanes = True 

And I am not able to find other code online.

like image 711
J T Avatar asked Oct 18 '25 10:10

J T


1 Answers

You can do it as follows:

import xlwings as xw
wb = xw.books.active
active_window = wb.app.api.ActiveWindow
active_window.FreezePanes = False
active_window.SplitColumn = 0
active_window.SplitRow = 6
active_window.FreezePanes = True
like image 113
Felix Zumstein Avatar answered Oct 20 '25 01:10

Felix Zumstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!