pyexcel-xlsxwx
Save pyexcel data with XlsxWriter, while retaining good formatting.
Features
- Allow setting column widths and word wrap.
- A package for reading data is not included, please see
pyexcel's plugins here.
Installation
$ pip install pyexcel-xlsxwx
Usage
>>> import pyexcel_xlsxwx
>>> data = OrderedDict() # from collections import OrderedDict
>>> data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]})
>>> data.update({"Sheet 2": [["row 1", "row 2", "row 3"]]})
>>> pyexcel_xlsxwx.save_data("your_file.xlsx", data)
You can also define a custom config via:
>>> pyexcel_xlsxwx.save_data("your_file.xlsx", data, config=config)
Where config can be dictionary or path to YAML file.
The default YAML config is:
workbook:
constant_memory: true
strings_to_numbers: false
strings_to_formulas: false
strings_to_urls: true
worksheet:
_default:
freeze_panes: A2
# column_width: 30
smart_fit: true
max_column_width: 30
format:
_default:
valign: top
text_wrap: true
column_width can also accept a list and a dictionary where key indicates the column.
row_height can also be set the same way.
To cancel out freeze_panes, try:
>>> pyexcel_xlsxwx.save_data("your_file.xlsx", data, config={'worksheet': {'_default': {'freeze_panes': None}}})
The settings will merge (thanks to https://stackoverflow.com/questions/20656135/python-deep-merge-dictionary-data), so that the other formattings won't be lost.
Related projects
- pyexcel-openpyxlx - export the styles for XlsxWriter.
- pyexcel-export - operates using OpenPyXL, which seeming has bad word wrap support. However, the formatting can be well preserved.
Metadata
Release files for pyexcel-xlsxwx 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyexcel-xlsxwx-0.1.8.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyexcel_xlsxwx-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.8 kB
Release files / pyexcel-xlsxwx-0.1.8.tar.gz
| Download URL | pyexcel-xlsxwx-0.1.8.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e25b0f9447ca996bca07d4729142c451b956530bba231be2d66330b79addb0d
|
|
BLAKE2b-256 checksum How to use checksums |
518b28f0d06f132d3d2cfe3f04501ed76e674ff9b9e892fb7819b248907d3fe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.2 Linux/5.16.5-arch1-1
|
Release files / pyexcel_xlsxwx-0.1.8-py3-none-any.whl
| Download URL | pyexcel_xlsxwx-0.1.8-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8f5c08f3a92308e5c4f693d00b84c0814534cae46f10688d29ab471bff60d83
|
|
BLAKE2b-256 checksum How to use checksums |
939d77cd0a90e6647d1f26fa91d3f4568329a4eea875572795357465cd7c59fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.2 Linux/5.16.5-arch1-1
|