IRONSOFTWAREHOME
Freeze Panes in Excel
from ironxl import *

# Load the Excel workbook
workbook = WorkBook.Load("sample.xls")
worksheet = workbook.WorkSheets[0]

# Create freeze pane from column(A-B) and row(1-3)
worksheet.CreateFreezePane(2, 3)

# Overwriting freeze or split pane to column(A-E) and row(1-5) as well as applying prescroll
# The column will show E, G, ... and the row will show 5, 8, ...
worksheet.CreateFreezePane(5, 5, 6, 7)

# Save changes with the created freeze panes
workbook.SaveAs("createFreezePanes.xls")

# Remove all existing freeze or split pane
worksheet.RemovePane()
pip install ironxl
Freeze Panes in Excel

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.

Learn How to Add Freeze Panes in Excel with Python

Ready to Get Started?

Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required