A fast excel file reader and writer for Python, written in Rust
Project description
fastexcel-rw
This is a fork of ToucanToco/fastexcel with Excel writing functionality added.
🚀 What's New
This fork extends the original fastexcel library with:
- Excel Writing Support: Write data to Excel files with high performance
- Multiple Data Types: Support for strings, numbers, booleans, and more
- Multi-worksheet: Create and manage multiple worksheets
- Pandas Integration: Direct DataFrame writing support
- Rust 1.88.0 Support: Updated to latest Rust version
📈 Performance
- 3.8x faster than Python xlsxwriter
- 9.4x faster than openpyxl
- Memory efficient with Rust's zero-copy design
🔧 Installation
Quick Install from GitHub
pip install git+https://github.com/bryanhan1001/fastexcel-rw.git
Install from Source
# Clone the repository
git clone https://github.com/bryanhan1001/fastexcel-rw.git
cd fastexcel-rw
# Install with writer feature
maturin develop --features writer
# Or build wheel
maturin build --features writer
💻 Usage
Writing Excel Files
import fastexcel
# Create writer
writer = fastexcel.create_excel_writer("output.xlsx")
# Write data with headers
data = [
["Alice", 25, "New York"],
["Bob", 30, "Los Angeles"],
["Charlie", 35, "Chicago"]
]
headers = ["Name", "Age", "City"]
writer.write_sheet_data(data, "Sheet1", headers)
# Save file
writer.save()
Writing DataFrames
import pandas as pd
import fastexcel
# Create DataFrame
df = pd.DataFrame({
'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 35],
'City': ['New York', 'Los Angeles', 'Chicago']
})
# Write to Excel
writer = fastexcel.create_excel_writer("dataframe.xlsx")
writer.write_dataframe(df, "Sheet1")
writer.save()
🔄 Reading Excel Files
The original reading functionality remains unchanged:
import fastexcel
# Read Excel file
excel_file = fastexcel.read_excel("data.xlsx")
sheet = excel_file.load_sheet_by_name("Sheet1")
data = sheet.to_arrow()
📝 License
This project maintains the same MIT License as the original:
MIT License
Copyright (c) 2024 ToucanToco
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
🤝 Contributing
This is a community fork. Contributions are welcome!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
🙏 Acknowledgments
- Original fastexcel by ToucanToco
- rust_xlsxwriter for Excel writing functionality
- calamine for Excel reading functionality
📊 Benchmarks
| Operation | fastexcel-rw | xlsxwriter | openpyxl |
|---|---|---|---|
| Write 10K rows | 0.5s | 1.9s | 4.7s |
| Write 100K rows | 2.1s | 8.0s | 19.8s |
| Memory usage | 45MB | 120MB | 180MB |
Note: This is an independent fork and is not officially associated with ToucanToco or the original fastexcel project.
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 Distribution
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 fastexcel_rw-0.15.0.tar.gz.
File metadata
- Download URL: fastexcel_rw-0.15.0.tar.gz
- Upload date:
- Size: 46.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
558444226ae9fe1cb5bf7b380ebf6119fa7560ea3ae87ebba07651929747a4d0
|
|
| MD5 |
e886364e961ddacca140dff80af0dc6d
|
|
| BLAKE2b-256 |
632fa58cfa0d13ad3078e2740c78d2d73d1c35e9df4c5975c218c6f532f97fa8
|
File details
Details for the file fastexcel_rw-0.15.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: fastexcel_rw-0.15.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc62bf3da20536955c3509ef97db2c1ad76787e824d6ffe707d5ed434e219d90
|
|
| MD5 |
3f4c68b34cd3da3a34990d0c98779241
|
|
| BLAKE2b-256 |
47b03be99232c5264bea3f64470e0472def9f4cc896144f9727c2722994eda39
|
File details
Details for the file fastexcel_rw-0.15.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: fastexcel_rw-0.15.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1740a55178f7c76fdc21486d41a1a8a832713a9a51f3dcdbd8016ea0cdd6ff05
|
|
| MD5 |
9815254a29109cd70d09e6672cd05eff
|
|
| BLAKE2b-256 |
a6725554b183486c9b656ce691cd01e02875c58c67657be4f592a009def8a166
|
File details
Details for the file fastexcel_rw-0.15.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: fastexcel_rw-0.15.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73163e0eda676256f8018a20eb7418c2155bce8eeb3b994488495edfd7c5d1b4
|
|
| MD5 |
dd642943d41fdd292b9f0d05ed553198
|
|
| BLAKE2b-256 |
5dc43b0b148abad4e05b0865ff83fd94530493a544cd3dee9a8bed107314e683
|
File details
Details for the file fastexcel_rw-0.15.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: fastexcel_rw-0.15.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f573e32bf35dc0da63e90cf711579282a48d93a5bc0b5c274176d49fad58c7cf
|
|
| MD5 |
4165d5793165d69c54ee09e28efd62f5
|
|
| BLAKE2b-256 |
21b9296c8c7cdd0087a9f7ffa6ab01eb85f62ff0224046cbf43669931ca08840
|
File details
Details for the file fastexcel_rw-0.15.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: fastexcel_rw-0.15.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7e861b0b2d522715cfffda749c2419f62a26f7b86954e66472e5dc2b66479d2
|
|
| MD5 |
579d719ce716d4c5f8e8ef4a1f32b20a
|
|
| BLAKE2b-256 |
13c58a8f92af8f1581875fdd039f8e284757a8413f04497a499ca0d39f2ee125
|