IRONSOFTWAREHOME
Select Excel Range
from ironxl import *

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

# Get range from worksheet
selected_range = worksheet["A2:A8"]

# Get column from worksheet
column_a = worksheet.GetColumn(0)

# Get row from worksheet
row_1 = worksheet.GetRow(0)

# Iterate over the range
for cell in selected_range:
    print(f"{cell.Value}")
pip install ironxl
Select Excel Range

Select Excel Range

IronXL for Python makes it easy to select and work with ranges in any Excel WorkSheet. The code below demonstrates how ranges, rows, and columns can be selected. After selection, aggregate methods such as SortAscending(), SortDescending(), Sum(), Max(), Min(), and Average() can be applied to the collected data. Note that when methods modify or move cell values, the affected range, row, or column will reflect those changes accordingly.

Range

To select a range from A2 to A8, use range_ = worksheet["A2:A8"].

Row

To select row 1, use worksheet.GetRow(0). Indexing is zero-based. The range of cells returned is determined by the union of all populated cells across all rows, including row 1 itself.

Column

To select column A, use worksheet.GetColumn(0) or assign the range address as worksheet["A:A"]. The range of cells is determined by the union of all populated cells across all columns, including column A itself.

How to Select an Excel Range in Python

  1. Install IronXL for Python to select Excel ranges.
  2. Load an existing workbook or create a new one.
  3. Select the target worksheet from the workbook.
  4. Use worksheet["A2:A8"] to select a range from A2 to A8.
  5. Use GetColumn and GetRow methods to select individual columns and rows.
Explore How to Select Excel Ranges with Python and IronXL.

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