Freeze Panes in Excel
The code example above shows how to create a freeze pane in Excel using IronXL for Python, locking rows and columns so they remain visible while scrolling. This is a valuable feature for keeping header rows or label columns in place when reviewing large datasets.
CreateFreezePane(column, row)
The first CreateFreezePane overload takes a column count and a row count to define the frozen area. For example, worksheet.CreateFreezePane(1, 4) creates a freeze pane covering column A and rows 1–4.
CreateFreezePane(column, row, subsequentColumn, subsequentRow)
This overload creates a freeze pane and also applies pre-scrolling to the worksheet. For example, worksheet.CreateFreezePane(5, 2, 6, 7) freezes columns A–E and rows 1–2, with the view scrolled to show 1 additional column and 5 additional rows. When the worksheet is first opened, it will display columns A–E, G–... and rows 1–2, 8–...
If you work with large data tables in Excel, freezing rows or columns keeps important labels visible while scrolling through the rest of the worksheet.
How to Add Freeze Panes in Excel Using Python
- Install IronXL for Python to add freeze panes in Excel
- Load an existing spreadsheet or create a new one
- Use the
CreateFreezePanemethod to add freeze panes - Optionally specify the third and fourth parameters to apply pre-scrolling
- Save the modified Excel file






