Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 348
Boobal Ganesan Avatar asked Sep 18 '25 19:09

Boobal Ganesan


1 Answers

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

like image 87
wilkben Avatar answered Sep 21 '25 15:09

wilkben