Registry / data / pyexcelerate

pyexcelerate

JSON →
library0.13.0pypypi✓ verified 87d ago

PyExcelerate is an accelerated Python library designed for quickly writing Excel XLSX files, with an emphasis on performance and efficient memory usage. It is currently at version 0.13.0 and supports both Python 2.7 and various Python 3 versions, though a strict release cadence is not always observed.

pip install pyexcelerate
INSTALL
IMPORT
SIG · PYEXCELERATE
P
pyexcelerate
datapythonv0.13.0
Install
1.8s avg
Import
338ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.13.0 · 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
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.350s · 19.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.8s · import 0.327s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Workbook
from pyexcelerate import Workbook

This quickstart demonstrates how to create a new Excel workbook, add a sheet with a 2D array of data, apply some basic styling, and save the workbook to a file. It highlights the primary use case of bulk data writing.

from pyexcelerate import Workbook import os data = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] # data is a 2D array wb = Workbook() ws = wb.new_sheet("MySheet", data=data) # Optional: Set column widths or row heights ws.set_col_style(1, ws.style.font.bold) ws.set_row_style(1, ws.style.font.italic) ws.cell(1,1).value = "Bold Italic" file_path = "output.xlsx" wb.save(file_path) print(f"Workbook saved to {os.path.abspath(file_path)}")
Debug
Known issues
gotchaPyExcelerate can consume a significant amount of memory when writing extremely large datasets, as it does not inherently offer a constant-memory mode like some other libraries. Users dealing with datasets of millions of rows might encounter memory exhaustion.
fix
For very large files and strict memory constraints, consider alternative libraries like XlsxWriter which offer a `constant_memory` option. Optimize data structures to reduce memory footprint before passing to PyExcelerate.
affects: All versions
gotchaApplying styles cell-by-cell can introduce substantial performance overhead, potentially slowing down execution by up to 10 times. PyExcelerate is optimized for speed when writing raw data.
fix
Minimize individual cell styling. Apply styles to entire rows, columns, or ranges where possible using `ws.set_row_style()`, `ws.set_col_style()`, or range styling to improve performance.
affects: All versions
gotchaWriting large dataframes primarily containing strings can occasionally result in corrupted or invalid XLSX files that Excel cannot open correctly. This issue seems to be more prevalent with specific data characteristics and large file sizes.
fix
If encountering this issue, try to preprocess or segment string data, or consider using alternative libraries for string-heavy large datasets. Check GitHub issues for potential workarounds or updates.
affects: All versions
gotchaWhen writing multiple sheets to a single workbook, ensure that the `Workbook()` object is instantiated only once. Repeatedly calling `wb = Workbook()` will create a new, empty workbook each time, overwriting any previously added sheets when `save()` is called.
fix
Instantiate the `Workbook()` object once, then add all sheets using `wb.new_sheet()` before a single `wb.save()` call.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyexcelerate'
The pyexcelerate library is not installed in your Python environment or the Python interpreter cannot locate it.
fix
Install pyexcelerate using pip: `pip install pyexcelerate`
ImportError: cannot import name 'Workbook' from 'pyexcelerate'
This usually happens if pyexcelerate is not correctly installed, or there's a naming conflict (e.g., a local file named `pyexcelerate.py` or `Workbook.py`), preventing the correct module from being imported. It can also occur if attempting to import from a non-existent submodule.
fix
Ensure `pyexcelerate` is installed correctly (`pip install pyexcelerate`) and that there are no local Python files named `pyexcelerate.py` or `Workbook.py` in your project directory that could shadow the actual library module. The correct import is `from pyexcelerate import Workbook`.
Exception('File size unexpectedly exceeded ZIP64 limit')
This error occurs when attempting to save an extremely large Excel file that exceeds the standard ZIP file format's 4GB limit, which pyexcelerate uses for XLSX files.
fix
Consider splitting your data into multiple smaller Excel files or using a different data storage format better suited for very large datasets.
We found a problem with some content in [filename].xlsx. Do you want us to try to recover as much as we can?
This message appears when Microsoft Excel detects that an XLSX file generated by pyexcelerate is malformed or contains invalid content, often when dealing with very large dataframes, especially those containing strings.
fix
Ensure your data types are consistent and handle potential edge cases (e.g., special characters, very long strings). For extremely large string-heavy dataframes, you might consider breaking them into smaller parts or checking for `pyexcelerate` updates that address large string handling. Temporarily converting problematic columns to strings before writing might also help.
AttributeError: 'NaTType' object has no attribute 'days'
This error typically arises when `pyexcelerate` attempts to write a pandas DataFrame containing `NaT` (Not a Time) values in a datetime column, and the underlying Excel writer tries to process these as valid date objects, which `NaTType` lacks attributes for.
fix
Before writing the DataFrame to Excel, fill or convert `NaT` values in datetime columns. For example, use `df.fillna('')` or `df[datetime_column].apply(lambda x: None if pd.isna(x) else x)` to replace `NaT` with `None` or an empty string.
Upgrade
Version history
0.13.0latest on PyPI · released May 23, 2025
Audit
Dependencies
jinja2requiredTemplate engine for XLSX file generation.
sixrequiredPython 2 and 3 compatibility utilities.
Agent activity
18 hits · last 30 days
node
18
Resources
pyexcelerate — pip install pyexcelerate · libregistry