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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With