3

How to freeze the top row in an Excel using WIN32COM python package? Searched almost everywhere, but could find examples with other packages, but not with "from win32com.client.gencache import EnsureDispatch" this one.

1 Answers1

1
from win32com.client.gencache import EnsureDispatch
excel = EnsureDispatch('Excel.Application')
excel.Cells.Range("A2").Select()
excel.ActiveWorkbook.Windows(1).FreezePanes = True

This will freeze all rows above, and all columns to the left of A2

wilkben
  • 657
  • 3
  • 12