Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.960 runs
installs and imports cleanly · install 0.0s · import 0.460s · 68.6MB
glibcpy 3.10–3.960 runs
installs and imports cleanly · install 3.7s · import 0.432s · 309MB
191MB installed
● package 191MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Workbook
✓ from openpyxl import Workbook
✗ import excel.Workbook
The `excel` package does not contain a Workbook class; `openpyxl` is the correct library.
load_workbook
✓ from openpyxl import load_workbook
✗ from excel import load_workbook
Attempting to import from 'excel' will result in an ImportError as the package is non-functional.
This quickstart demonstrates how to create a new Excel workbook, write data to it, save it, and then load an existing workbook to read data using `openpyxl`, the most commonly used library for direct `.xlsx` file manipulation.
from openpyxl import Workbook
from openpyxl import load_workbook
# Create a new workbook
wb = Workbook()
ws = wb.active
ws.title = "Sheet1"
ws['A1'] = 'Hello'
ws['B1'] = 'World!'
# Save the workbook
file_path = "example.xlsx"
wb.save(file_path)
print(f"Created {file_path}")
# Load an existing workbook
loaded_wb = load_workbook(file_path)
loaded_ws = loaded_wb.active
cell_a1_value = loaded_ws['A1'].value
print(f"Value from A1: {cell_a1_value}")
Debug
Known issues
breakingThe `excel` package on PyPI is a reserved placeholder and does not contain any functional code. Attempting to install or import from it will not provide Excel manipulation capabilities.fixAlways use specific, functional libraries like `openpyxl`, `pandas`, `xlsxwriter`, or `xlwings` instead of `excel`.
affects: All versions (1.0.1)
gotchaWhen working with `openpyxl`, remember that cell coordinates are 1-indexed (e.g., 'A1', 'B2') and sheets are accessed by name or by being the active sheet. New workbooks always start with one active sheet.fixRefer to `openpyxl`'s official documentation for detailed usage, especially regarding cell addressing and sheet manipulation to avoid unexpected behavior.
affects: openpyxl 2.x and 3.x
gotchaIf you're dealing with older `.xls` files (not `.xlsx`), `openpyxl` will not work. You'll need libraries like `xlrd` (for reading) or `xlwt` (for writing).fixDetermine the file format (`.xls` vs. `.xlsx`) before choosing a library. Use `xlrd` or `xlwt` for `.xls` files and `openpyxl`, `xlsxwriter`, or `pandas` for `.xlsx` files.
affects: All Python Excel libraries
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'excel'
You tried to import directly from a module named 'excel', which does not exist as a functional library after installing the PyPI placeholder package.
fixInstall and import from a specific Excel library, e.g., `pip install openpyxl` then `from openpyxl import Workbook`.
zipfile.BadZipFile: File is not a zip file
Attempting to open an `.xls` file with `openpyxl` (which expects `.xlsx` files).
fixEnsure you are using `openpyxl` with `.xlsx` files. For `.xls` files, use `xlrd` (e.g., `import xlrd; workbook = xlrd.open_workbook('your_file.xls')`). TypeError: 'str' object cannot be interpreted as an integer
Often occurs when iterating over cells or trying to access them by string coordinates where an integer index is expected, or vice-versa, especially when mixing `openpyxl`'s 1-indexed string notation with 0-indexed integer loops.
fixDouble-check cell access methods. Use `ws.cell(row=1, column=1)` for integer-based access or `ws['A1']` for string-based access, ensuring consistency.
Upgrade
Version history
1.0.1latest on PyPI · released Jan 9, 2023
Audit
Dependencies
No dependency data recorded yet.