High performace excel file generation library.
Project description
pyfastexcel
This package enables high-performance Excel writing by integrating with the streaming API from the golang package excelize. Users can leverage this functionality without the need to write any Go code, as the entire process can be accomplished through Python.
Features
-
Python and Golang Integration: Seamlessly call Golang built shared libraries from Python.
-
No Golang Code Required: Users can solely rely on Python for Excel file generation, eliminating the need for Golang expertise.
Installation
Install via pip (Recommended)
You can easily install the package via pip
pip install pyfastexcel
Install manually
If you prefer to build the package manually, follow these steps:
-
Clone the repository:
git clone https://github.com/Zncl2222/pyfastexcel.git
-
Go to the project root directory:
cd pyfastexcel
-
Install the required golang packages:
go mod download
-
Build the Golang shared library using the Makefile:
make
-
Install the required python packages:
pip install -r requirements.txt
or
pipenv install -
Import the project and start using it!
Requirements
| Operating System | Version |
|---|---|
| Linux | Ubuntu 18.04 or higher |
| macOS | macOS 13 (x86-64) |
| Windows | Windows 10 or higher |
Python Versions
- Python 3.8 or higher
For earlier versions of Python or other operating systems, compatibility is not guaranteed.
Usage
The index assignment is now avaliable in Workbook and the StreamWriter.
Here is the example usage:
from pyfastexcel import Workbook
from pyfastexcel.utils import set_custom_style
# CustomStyle will be re-implement in future to make it no-longer
# depend on openpyxl_style writer and openpyxl
from pyfastexcel import CustomStyle
if __name__ == '__main__':
# Workbook
wb = Workbook()
# Set and register CustomStyle
bold_style = CustomStyle(font_size=15, font_bold=True)
set_custom_style('bold_style', bold_style)
ws = wb['Sheet1']
# Write value with default style
ws['A1'] = 'A1 value'
# Write value with custom style
ws['B1'] = ('B1 value', 'bold_style')
# Write value in slice with default style
ws['A2': 'C2'] = [1, 2, 3]
# Write value in slice with custom style
ws['A3': 'C3'] = [(1, 'bold_style'), (2, 'bold_style'), (3, 'bold_style')]
# Write value by row with default style (python index 0 is the index 1 in excel)
ws[3] = [9, 8, 'go']
# Write value by row with custom style
ws[4] = [(9, 'bold_style'), (8, 'bold_style'), ('go', 'bold_style')]
# Send request to golang lib and create excel
wb.read_lib_and_create_excel()
# File path to save
file_path = 'pyexample_workbook.xlsx'
wb.save(file_path)
For row-by-row Excel writing, consider using StreamWriter, a
subclass of Workbook. This class is optimized for streaming large datasets.
Learn more in the StreamWriter documentation.
Explore additional examples in the FullExamples.
Documentation
The documentation is hosted on Read the Docs.
Benchmark
The following result displays the performance comparison between
pyfastexcel and openpyxl for writing 50000 rows with 30
columns (Total 1500000 cells). To see more benchmark results, please
see the benchmark.
How it Works
The core functionality revolves around encoding Excel cell data and styles, or any other Excel properties, into a JSON string within Python. This JSON payload is then passed through ctypes to a Golang shared library. In Golang, the JSON is parsed, and using the streaming writer of excelize to wrtie excel in high performance.
Current Limitations & Future Plans
Problem 1: Dependence on Other Excel Package
Limitations:
This project currently depends on the CustomStyle object of
the openpyxl_style_writer
package, which is built for openpyxl to write styles in write-only
mode more efficiently without duplicating code.
Future Plans:
This project plans to create its own Style object, making it no longer
dependent on the mentioned package.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfastexcel-0.1.8-py3-none-win_amd64.whl.
File metadata
- Download URL: pyfastexcel-0.1.8-py3-none-win_amd64.whl
- Upload date:
- Size: 3.9 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bdae0b0be9fa137abb11d4fa63e9523afffdecbe94900f35c826953a24310e8
|
|
| MD5 |
3e2a04c64f21963e2bb7c62518873a18
|
|
| BLAKE2b-256 |
ac8a133e6d492bd4c268231b90a6e52a8f88f71563a04abddeffa1ec0cea48b9
|
Provenance
The following attestation bundles were made for pyfastexcel-0.1.8-py3-none-win_amd64.whl:
Publisher:
pypi.yml on Zncl2222/pyfastexcel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfastexcel-0.1.8-py3-none-win_amd64.whl -
Subject digest:
6bdae0b0be9fa137abb11d4fa63e9523afffdecbe94900f35c826953a24310e8 - Sigstore transparency entry: 152645708
- Sigstore integration time:
-
Permalink:
Zncl2222/pyfastexcel@69db9374485841b7a6093c21ee38769f4d942781 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/Zncl2222
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@69db9374485841b7a6093c21ee38769f4d942781 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyfastexcel-0.1.8-py3-none-manylinux2014_x86_64.whl.
File metadata
- Download URL: pyfastexcel-0.1.8-py3-none-manylinux2014_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cef2090c4bba08366761a55f3fe35b15e65f5e9693e651c83093666fb2b072b
|
|
| MD5 |
2f3c8b60b9f415fa883eb77b9ebb8132
|
|
| BLAKE2b-256 |
bfa88db94aebedcae7c0259ff84ae0ea43c3a965360e4e9e05045534f5cb8765
|
Provenance
The following attestation bundles were made for pyfastexcel-0.1.8-py3-none-manylinux2014_x86_64.whl:
Publisher:
pypi.yml on Zncl2222/pyfastexcel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfastexcel-0.1.8-py3-none-manylinux2014_x86_64.whl -
Subject digest:
2cef2090c4bba08366761a55f3fe35b15e65f5e9693e651c83093666fb2b072b - Sigstore transparency entry: 152645712
- Sigstore integration time:
-
Permalink:
Zncl2222/pyfastexcel@69db9374485841b7a6093c21ee38769f4d942781 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/Zncl2222
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@69db9374485841b7a6093c21ee38769f4d942781 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyfastexcel-0.1.8-py3-none-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pyfastexcel-0.1.8-py3-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b6cd0d8e44ef143c111693b2cc36e32ac01a816850cb0925feb0b064ddf785d
|
|
| MD5 |
a687e7241774a648cc7ff3ec0d7946af
|
|
| BLAKE2b-256 |
7d0fe6c4fc12aee0b4e57da59fa9c66fba9a91761aca06fc643123f0e017e401
|
Provenance
The following attestation bundles were made for pyfastexcel-0.1.8-py3-none-macosx_10_9_x86_64.whl:
Publisher:
pypi.yml on Zncl2222/pyfastexcel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyfastexcel-0.1.8-py3-none-macosx_10_9_x86_64.whl -
Subject digest:
5b6cd0d8e44ef143c111693b2cc36e32ac01a816850cb0925feb0b064ddf785d - Sigstore transparency entry: 152645714
- Sigstore integration time:
-
Permalink:
Zncl2222/pyfastexcel@69db9374485841b7a6093c21ee38769f4d942781 -
Branch / Tag:
refs/tags/v0.1.8 - Owner: https://github.com/Zncl2222
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@69db9374485841b7a6093c21ee38769f4d942781 -
Trigger Event:
release
-
Statement type: