IRONSOFTWAREHOME
Insert Rows & Columns into Excel in Python
from ironxl import *

# Load existing spreadsheet
workbook = WorkBook.Load("sample.xlsx")
worksheet = workbook.DefaultWorkSheet

# Add a row before row 1
worksheet.InsertRow(0)

# Insert multiple rows before row 4
worksheet.InsertRows(3, 3)

# Add a column before column A
worksheet.InsertColumn(0)

# Insert multiple columns before column F
worksheet.InsertColumns(5, 2)

# Save changes with added rows and columns
workbook.SaveAs("addRowAndColumn.xlsx")
pip install ironxl
Insert Rows & Columns into Excel in Python

Insert Rows & Columns into Excel in Python

IronXL for Python provides the ability to insert individual or multiple rows and columns programmatically, without requiring Office Interop.

Insert Row

The InsertRow and InsertRows methods add new rows to the worksheet. Rows are inserted before the specified index position.

Insert Column

Use the InsertColumn and InsertColumns methods to add one or more columns before the specified index position.

All index positions use zero-based indexing.

Learn How to Add Rows and Columns 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