Python Excel libraries

Updated Nov 2026

Python Excel libraries read and write spreadsheet files from code, most of them without Excel installed. These libraries automate the reports, data imports, and exports that teams exchange as Excel workbooks.

Popularity

openpyxl has the most installs, while XlsxWriter has the most GitHub stars.

LibraryMonthly downloadsStarsLast releaseLicense
openpyxl
283.0M
Not on GitHubJun 2024MIT
XlsxWriter
95.4M
4.0KOct 2026BSD-2-Clause
xlrd
67.0M
2.2KJun 2025BSD-3-Clause
pyxlsb
8.6M
96Oct 2022LGPL-3.0
python-calamine
6.7M
510Nov 2026MIT
pyexcel-io
1.4M
58Jun 2026BSD-3-Clause
xlwings
578.0K
3.4KOct 2026BSD-3-Clause
PyExcelerate
400.7K
559May 2025BSD-2-Clause
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Features compared

LibraryEdits existing workbooksWrites cell formattingAdds native chartsWorks with pandasOutput formats
openpyxlBuilt-inBuilt-inBuilt-inVia pluginXLSX, XLSM
XlsxWriterUnsupportedBuilt-inBuilt-inVia pluginXLSX
xlrdUnsupportedUnsupportedUnsupportedBuilt-inNot documented
pyxlsbUnsupportedUnsupportedUnsupportedVia pluginUnsupported
python-calamineUnsupportedUnsupportedUnsupportedBuilt-inNot documented
pyexcel-ioBuilt-inUnsupportedUnsupportedUndocumentedCSV
xlwingsBuilt-inBuilt-inBuilt-inBuilt-inXLSX, XLSM
PyExcelerateUnsupportedBuilt-inUnsupportedUnsupportedXLSM
Built-inVia pluginNot supportedNot documented

Libraries and code examples

openpyxl reads and writes Excel workbooks in the Office Open XML formats, .xlsx, .xlsm, .xltx, and .xltm, without Excel installed. Workbook creates a new file, and ws.append adds a row to a worksheet. Cells are read and set by coordinate, with Python values such as dates converted to Excel types automatically. Unlike XlsxWriter, openpyxl also opens existing workbooks and changes their sheets, cells, and formulas.

Downloads / mo
283.0M
Last release
3.1.5, Jun 2024
License
MIT

Strengths

  • Edits existing workbooks. Opens a workbook so code can change its sheets, cells, and formulas.
  • Handles large files. Read-only and write-only modes keep memory low, without styles.

Limitations

  • Memory per cell. Each cell takes one to two kilobytes. Read-only and write-only modes cut memory use on large sheets.
  • Can drop content on save. Saving an opened workbook loses any part openpyxl doesn't read.
  • No XML attack guard by default. Untrusted files need the defusedxml package installed, which openpyxl then uses to block billion laughs and quadratic blowup attacks.

Quickstart

From the docs
$ pip install openpyxl
from openpyxl import Workbook
wb = Workbook()

# grab the active worksheet
ws = wb.active

# Data can be assigned directly to cells
ws['A1'] = 42

# Rows can also be appended
ws.append([1, 2, 3])

# Save the file
wb.save("sample.xlsx")

openpyxl examples

From open-source projects on GitHub

Reads the active sheet of an uploaded xlsx file into a list of rows with openpyxl's load_workbook.

Writes each dataset in a book to its own worksheet and saves the workbook as bytes with openpyxl.

XlsxWriter writes new Excel .xlsx files using only the Python standard library. A Workbook contains worksheets created with add_worksheet. The write method places text, numbers, formulas, or links into cells, with styles made by add_format. Charts, images, conditional formatting, data validation, and macros are supported, along with a memory optimization mode for large files. pandas and Polars can both use XlsxWriter to save DataFrames.

Downloads / mo
95.4M
Stars
4.0K
Last release
3.3.1, Oct 2026
License
BSD-2-Clause

Strengths

  • Clean files for Excel. Writes text, numbers, formulas, and links to sheets Excel opens cleanly.
  • Native charts and images. Adds Excel charts, images, and conditional formatting.

Limitations

  • New files only. Can't open or edit an existing workbook.

Quickstart

From the README
$ pip install xlsxwriter
import xlsxwriter

# Create an new Excel file and add a worksheet.
workbook = xlsxwriter.Workbook("demo.xlsx")
worksheet = workbook.add_worksheet()

# Add a bold format to use to highlight cells.
bold = workbook.add_format({"bold": True})

# Write some simple text.
worksheet.write("A1", "Hello")

# Text with formatting.
worksheet.write("A2", "World", bold)

workbook.close()

XlsxWriter examples

From open-source projects on GitHub

Writes rows to a new xlsx sheet with XlsxWriter in constant-memory mode, with a bold header row and cell formats.

Writes DataFrame cells to an xlsx worksheet with XlsxWriter, reusing formats and merging cells where needed.

xlrd reads data and formatting from Excel files in the older .xls format and no other format. open_workbook returns a book, sheet_by_index returns a sheet, and cell_value reads one cell. Formula results come back as values. Each sheet exposes cell comments through cell_note_map and hyperlinks through hyperlink_map. Newer formats need another library, such as openpyxl for .xlsx.

Downloads / mo
67.0M
Stars
2.2K
Last release
2.0.2, Jun 2025
License
BSD-3-Clause

Strengths

  • Reads old .xls files. The standard reader for .xls, with no dependencies.
  • Built into pandas. pandas.read_excel uses xlrd for .xls files automatically.

Limitations

  • .xls files only. Use openpyxl or python-calamine for .xlsx files.
  • Skips charts and macros. Charts, macros, and pictures are ignored on read.
  • No password-protected files. Locked .xls files can't be opened.

Quickstart

From the README
$ pip install xlrd
import xlrd
book = xlrd.open_workbook("myfile.xls")
print("The number of worksheets is {0}".format(book.nsheets))
print("Worksheet name(s): {0}".format(book.sheet_names()))
sh = book.sheet_by_index(0)
print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols))
print("Cell D30 is {0}".format(sh.cell_value(rowx=29, colx=3)))
for rx in range(sh.nrows):
    print(sh.row(rx))

xlrd examples

From open-source projects on GitHub

Reads every sheet of an xls file into tablib datasets with xlrd's open_workbook.

Opens an xls workbook with xlrd from either a file path or an in-memory buffer.

_xlrd.py · load_workbook() · pushed Nov 2026
def load_workbook(self, filepath_or_buffer, engine_kwargs) -> Book:
    from xlrd import open_workbook

    if hasattr(filepath_or_buffer, "read"):
        data = filepath_or_buffer.read()
        return open_workbook(file_contents=data, **engine_kwargs)
    else:
        return open_workbook(filepath_or_buffer, **engine_kwargs)

pyxlsb reads Excel binary workbooks, the .xlsb format. open_workbook opens a file, get_sheet picks a sheet by name or by position counting from one, and rows iterates over the sheet as lists of cells. Dates arrive as floats, which convert_date turns into datetime values. The README describes the library as limited but enough for basic data extraction.

Downloads / mo
8.6M
Stars
96
Last release
1.0.10, Oct 2022
License
LGPL-3.0

Strengths

  • Reads big .xlsb files row by row. Returns rows as it reads them, so large files stay manageable.
  • Built into pandas. pandas.read_excel uses pyxlsb for .xlsb files automatically.

Limitations

  • Reads rows only. Can't write files or read formatting.
  • Errors come back as codes. Cells like #DIV/0! return as hex codes to map back by hand.
  • Dates come back as numbers. Each date needs convert_date() to become a datetime.

Quickstart

From the README
$ pip install pyxlsb
from pyxlsb import open_workbook
with open_workbook('Book1.xlsb') as wb:
    with wb.get_sheet(1) as sheet:
        for row in sheet.rows():
            print(row)

pyxlsb examples

From open-source projects on GitHub

Reads an xlsb sheet into a list of rows with pyxlsb, trimming trailing empty cells and padding short rows.

python-calamine

python-calamine is a Python binding for calamine, a Rust library for Excel and OpenDocument spreadsheets: .xlsx, .xlsm, .xlsb, .xls, and .ods. CalamineWorkbook.from_path opens a file, and a sheet's to_python method returns its cells as a list of rows. Blank rows and columns before the data are skipped unless skip_empty_area is false. pandas reads through python-calamine with engine="calamine", so one engine covers formats that otherwise need openpyxl, xlrd, and pyxlsb.

Downloads / mo
6.7M
Stars
510
Last release
0.9.1, Nov 2026
License
MIT

Strengths

  • Fastest reader. Reads .xlsx, .xlsm, .xlsb, .xls, and .ods faster than the others here.
  • Works inside pandas. pandas reads through it with engine="calamine".

Limitations

  • Read-only. Writing files needs another library, such as openpyxl.
  • Whole numbers become floats. IDs and counts come back as floats, such as 0.0.

Quickstart

From the README
$ pip install python-calamine
from python_calamine import CalamineWorkbook

workbook = CalamineWorkbook.from_path("file.xlsx")
workbook.sheet_names
# ["Sheet1", "Sheet2"]

workbook.get_sheet_by_name("Sheet1").to_python()
# [
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ]

python-calamine examples

From open-source projects on GitHub

Reads every sheet of an Excel file from cloud storage with python-calamine and turns each one into delimited text.

Reads an Excel sheet into rows with python-calamine's to_python, turning whole floats into integers.

pyexcel-io reads and writes spreadsheet data through one pair of functions, get_data and save_data. The same functions move data into and out of Django and SQLAlchemy databases. CSV and TSV work without extras. Excel and OpenDocument formats each come from a plugin package, such as pyexcel-xlsx, built on openpyxl, or pyexcel-xls, built on xlrd. When two installed plugins handle the same format, the library argument picks one per call.

Downloads / mo
1.4M
Stars
58
Last release
0.6.8, Jun 2026
License
BSD-3-Clause

Strengths

  • One API for every format. The same calls read and write CSV, xls, xlsx, and ods.
  • Loads into databases. Moves sheet data into and out of Django and SQLAlchemy.

Limitations

  • Values only. No fonts, colors, charts, or password-protected files.
  • Plugin per format. xls, xlsx, and ods each need a separate plugin package.

Quickstart

From the docs
$ pip install pyexcel-io
from pyexcel_io import save_data
data = [[1, 2, 3], [4, 5, 6]]
save_data("your_file.csv", data)

from pyexcel_io import get_data
data = get_data("your_file.csv")

pyexcel-io examples

From open-source projects on GitHub

Reads spreadsheet data with pyexcel-io, using iget_data to read on demand and get_data otherwise.

xlwings controls a running copy of Excel from Python on Windows and macOS, so Excel has to be installed. xw.Book opens or connects to a workbook, wb.sheets returns a sheet, and assigning to a range's value writes cells. Converters move NumPy arrays and pandas DataFrames in both directions. In the other direction, macros written in Python replace VBA, and user-defined functions run in cells on Windows. Excel itself recalculates formulas and saves the file.

Downloads / mo
578.0K
Stars
3.4K
Last release
0.37.8, Oct 2026
License
BSD-3-Clause

Strengths

  • DataFrames in and out of Excel. Moves pandas DataFrames to Excel ranges and back.
  • Replaces VBA. Writes Excel macros and custom functions in Python.
  • Formulas recalculate. Excel itself saves the file, so formulas update.

Limitations

  • Needs Excel installed. Runs only on a desktop with Excel, so server jobs are fragile.
  • Some features are paid. xlwings Server, Reports, and Reader are part of xlwings PRO, which needs a paid license for commercial use.

Quickstart

From the docs
$ pip install xlwings
import xlwings as xw

wb = xw.Book()  # this will open a new workbook
sheet = wb.sheets['Sheet1']
sheet['A1'].value = 'Foo 1'
print(sheet['A1'].value)

xlwings examples

From open-source projects on GitHub

Refreshes a dropdown's source range in the open workbook from a pandas DataFrame with xlwings.

Writes the latest release to a cell and inserts a Matplotlib chart into the open sheet with xlwings.

PyExcelerate

PyExcelerate writes .xlsx files with an emphasis on speed. new_sheet takes a two-dimensional list of values at once, and range writes a block of cells. Single cells, formulas, dates, merged cells, and styles are supported too, though each step away from bulk values runs slower. In the README's benchmark, bulk values write faster than with XlsxWriter or openpyxl.

Downloads / mo
400.7K
Stars
559
Last release
0.13.0, May 2025
License
BSD-2-Clause

Strengths

  • Fast bulk writes. Writes 1000 rows by 100 columns of values in 0.47 seconds.

Limitations

  • Styles slow writes. In the README benchmark, a styled sheet of 1000 rows by 100 columns takes 2.40 to 6.15 seconds, against 0.47 for plain values.
  • Writes only. Reading files and conditional formatting need another library.

Quickstart

From the README
$ pip install pyexcelerate
from pyexcelerate import Workbook

wb = Workbook()
ws = wb.new_sheet("test", data=[[1, 2], [3, 4]])
wb.save("output.xlsx")

PyExcelerate examples

From open-source projects on GitHub

Writes results to an xlsx file with PyExcelerate and styles the header rows and columns.

Exports Django products to an xlsx file with PyExcelerate's Workbook and new_sheet.

FAQ

It depends on the job: openpyxl edits existing .xlsx workbooks and has 283.0M downloads a month, XlsxWriter builds new formatted files, python-calamine reads fastest, and xlwings drives Excel itself.

pandas.read_excel() reads a sheet into a DataFrame and picks a reader by file type: openpyxl for .xlsx, xlrd for .xls, and pyxlsb for .xlsb. Pass engine="calamine" to read through python-calamine instead, which is faster. pandas plans to make calamine the default .xlsx reader.

No. openpyxl keeps the pivot tables in an existing file when it saves, and can change a pivot table's range or refresh setting, but it can't create a new one. xlwings can build one, because it drives a running copy of Excel.

openpyxl reads, edits, and writes .xlsx files. XlsxWriter only writes new files, but it has the richer formatting options, native charts, and a constant_memory mode for very large exports. Use openpyxl to change a workbook that already exists, and XlsxWriter to build a report from scratch.

pandas shapes the data and openpyxl handles the file. pandas.read_excel() and DataFrame.to_excel() call openpyxl or XlsxWriter underneath. Use openpyxl directly for cell formatting, formulas, or editing a workbook in place.

Yes. xlwings lets Excel call Python functions from cells and replaces VBA macros with Python code. It needs a desktop copy of Excel on Windows or macOS.

openpyxl is a Python library that reads and writes Excel .xlsx and .xlsm files. It can open an existing workbook, change its sheets, cells, and formulas, and save it. pandas uses it as the default .xlsx reader.

For coding agents

Found your Excel library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official