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.1.13.tar.gz
(7.5 kB
view details)
Built Distribution
poi-0.1.13-py3-none-any.whl
(8.0 kB
view details)
File details
Details for the file poi-0.1.13.tar.gz
.
File metadata
- Download URL: poi-0.1.13.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4 Darwin/19.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4a512bb1baaedc038c69c67caedd335972f7e5f5d4c0d2c9fd4b367a9624d9d |
|
MD5 | 95dc7feca8e51b33b5e0e86ea73799b2 |
|
BLAKE2b-256 | a4b6c25381715c7805dd977da93c7d3d176be75fb28872fa5d980cd63ff3808f |
File details
Details for the file poi-0.1.13-py3-none-any.whl
.
File metadata
- Download URL: poi-0.1.13-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4 Darwin/19.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a089ad7dd1b3286c2325f8a2183f0f620497217c25665f900b3dbf20fe9582f7 |
|
MD5 | 95ea26565de23a666bdbb07351d03679 |
|
BLAKE2b-256 | b18e8e33b5de7a59ce7eb3d9481f3992a92cc4ab12753dd6c9bc07bba098f1e9 |