Introduction
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.
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.
Dependency
The dependency for python and golang
python:
msgspec (for faster json encoding)
pydantic v2
golang:
excelize (Core functionality)
marshmallow (for faster json decoding)
Installation
Install via pip (Recommended)
You can easily install the package via pip
Install manually
If you prefer to build the package manually, follow these steps:
-
Clone the repository:
-
Go to the project root directory:
-
Install the required golang packages:
-
Build the Golang shared library using the Makefile:
-
Install the required python packages:
or
-
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.
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.