Libraries, speed & errors

openpyxl

Cell-level reading, writing and styling with openpyxl.

The openpyxl object model: a Workbook holds Worksheets, a Worksheet holds Cells addressed like B2, and each cell has a value, a style and a number format.The openpyxl object model: a Workbook holds Worksheets, a Worksheet holds Cells addressed like B2, and each cell has a value, a style and a number format.workbook → worksheet → cellAB1wb = load_workbook()2ws = wb["Sales"]3ws["B2"].value4104ws["B2"].fontbold5ws["B2"].number_format#,##0

Start with the full guides

The long-form treatment of openpyxl, with the reasoning the shorter pages assume.

Step-by-step how-tos

One task each, with code you can copy, run and adapt.

Compare the options

Which tool or approach to pick, and why.

When it breaks

The errors this topic produces, with the cause explained rather than just the fix.

Follow it through a track

Prefer an ordered route? These tracks cover openpyxl along the way, in the order that builds on itself.

Related topics

Subjects that keep turning up on the same pages as this one, most overlap first.

openpyxl is part of Libraries, speed & errors.