Write Excel XLSX declaratively.
Project description
Poi: Make creating Excel XLSX files fun again.
Poi helps you write Excel sheet in a declarative way, ensuring you have a better Excel writing experience.
It only supports Python 3.7+.
Quick start
Create a sheet object and write to a file.
from poi import Sheet
sheet = Sheet(
root=Col(
colspan=8,
children=[
Row(
children=[
Cell(
"hello",
offset=2,
grow=True,
bg_color="yellow",
align="center",
border=1,
)
]
),
],
)
)
sheet.write('hello.xlsx')
See, it's pretty simple and clear.
Sample for rendering a simple table.
class Record(NamedTuple):
name: str
desc: str
remark: str
data = [
Record(name=f"name {i}", desc=f"desc {i}", remark=f"remark {i}")
for i in range(3)
]
columns = [("name", "名称"), ("desc", "描述"), ("remark", "备注")]
sheet = Sheet(
root=Table(
data=data,
columns=columns,
cell_width=20,
cell_style={
"bg_color: yellow": lambda record, col: col.attr == "name"
and record.name == "name 1"
},
date_format="yyyy-mm-dd",
align="center",
border=1,
)
)
sheet.write('table.xlsx')
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
poi-0.2.2.tar.gz
(8.7 kB
view details)
Built Distribution
poi-0.2.2-py3-none-any.whl
(9.0 kB
view details)
File details
Details for the file poi-0.2.2.tar.gz
.
File metadata
- Download URL: poi-0.2.2.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Darwin/19.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cb1c34120a1bca93ab899698f1c778c81de733d0b9967278935704800bdcbfc |
|
MD5 | ddc3d5f008652589191ebe40ec61a892 |
|
BLAKE2b-256 | 04661db68a24527c20d6019ecd2ba4bebb81aa71559f0d298fe888c394376f12 |
File details
Details for the file poi-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: poi-0.2.2-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.0 Darwin/19.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68def46078c48625e846f2063c1082fae1a253e5982d933e8f0b61bd35f95508 |
|
MD5 | 03b69b09fb8142a49a2c28a0afe0d495 |
|
BLAKE2b-256 | aa0a144f9cf17ced820a349707390a0606a0543ee432d0f8f7bec975a60c03bf |