This is a fork of ToucanToco/fastexcel with Excel writing functionality added.
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
- 3.8x faster than Python xlsxwriter
- 9.4x faster than openpyxl
- Memory efficient with Rust's zero-copy design
pip install git+https://github.com/bryanhan1001/fastexcel-rw.git# 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 writerimport 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()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()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()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.
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
- Original fastexcel by ToucanToco
- rust_xlsxwriter for Excel writing functionality
- calamine for Excel reading functionality
| 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.