Boobal Ganesan
Boobal Ganesan

Reputation: 61

How to freeze the top row in an Excel using WIN32COM python package?

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.

Upvotes: 4

Views: 1090

Answers (1)

wilkben
wilkben

Reputation: 667

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

Upvotes: 2

Related Questions