Skip to content
This repository was archived by the owner on Aug 29, 2026. It is now read-only.

仓库 files navigation

IronXLPython.Examples

Runnable Python examples for IronXL for Python, an Excel library that reads, writes, and edits XLSX, XLS, CSV, and TSV files without Microsoft Office or COM Interop.

Install

pip install ironxl

Quickstart

from ironxl import *

License.LicenseKey = "YOUR-LICENSE-KEY"

# Load an existing workbook and read a cell
workbook = WorkBook.Load("sample.xlsx")
worksheet = workbook.WorkSheets[0]
print(worksheet["A2"].Value)

# Indexing with a range string returns an iterable Range
for cell in worksheet["A2:B10"]:
    print(f"Cell {cell.AddressString} has value '{cell.Text}'")

# Write a value and save
worksheet["C1"].Value = "Updated"
workbook.SaveAs("updated.xlsx")

IronXL for Python wraps the .NET library, so members keep their .NET PascalCase namesSaveAs, not save_as, and WorkSheets, not worksheets. A snake_case attribute is a sign the call is wrong. Ranges are reached by indexing the worksheet with a range string; there is no range() method.

WorkBook.Create(ExcelFileFormat.XLSX) starts a new workbook and requires a license key, unlike loading, so set License.LicenseKey before creating.

What's in this repo

Each folder contains a self-contained project with a requirements.txt. Run pip install -r requirements.txt, then python program.py:

  • get-started/ — license-key setup
  • quickstart/ — an end-to-end project scaffold with tests
  • tutorials/ — a longer walkthrough covering reading an Excel file end to end

Common tasks covered

  • Loading XLSX and XLS workbooks and selecting worksheets
  • Reading cell values, text, and addresses across a range
  • Creating new workbooks and worksheets, and setting document metadata
  • Writing cell values and saving to XLSX, XLS, CSV, JSON, and XML
  • Cell formulas with automatic recalculation, read back as DecimalValue
  • Cell styling: borders, border types, and colours
  • Sorting a range ascending or descending

Platform support

Python 3.7 and above. Windows, macOS, and Linux. See the documentation for environment-specific notes.

Documentation and support

关于

This repository is maintained by Iron Software. IronXL for Python is a commercial library — see licensing for terms and trial details.

关于

Python Excel library that reads, writes, and edits XLSX, XLS, CSV, and TSV files without Microsoft Office or Interop. Runnable Python examples for loading workbooks, cell and range addressing, formulas with automatic recalculation, sorting, border and colour styling, and export to CSV, JSON, and XML. Python 3.7+.

Topics

Resources

Stars

1 star

关注者

2 watching

复刻s

发布

Used by

贡献者

Languages