Name | poi JSON |
Version |
1.2.3
JSON |
| download |
home_page | None |
Summary | Write Excel XLSX declaratively. |
upload_time | 2025-08-06 13:27:44 |
maintainer | None |
docs_url | None |
author | Ryan Wang |
requires_python | >=3.9 |
license | None |
keywords |
xlsx
xlswriter
excel
declarative
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Poi: The Declarative Way to Excel at Excel in Python

## Why Poi?
Creating Excel files programmatically has always been a chore. Current libraries offer limited flexibility, especially when you need more than a basic table. That's where Poi comes in, offering you a simple, intuitive, yet powerful DSL to make Excel files exactly the way you want them.
## Installation
```bash
pip install poi
```
## Quick start
### Create a sheet object and write to a file.
```python
from poi import Sheet, Cell
sheet = Sheet(
root=Cell("hello world")
)
sheet.write('hello.xlsx')
```

See, it's pretty simple and clear.
### Create a Dynamic Table with Conditional Formatting
```python
from typing import NamedTuple
from datetime import datetime
import random
from poi import Sheet, Table
class Product(NamedTuple):
name: str
desc: str
price: int
created_at: datetime
img: str
data = [
Product(
name=f"prod {i}",
desc=f"desc {i}",
price=random.randint(1, 100),
created_at=datetime.now(),
img="./docs/assets/product.jpg",
)
for i in range(5)
]
columns = [
{
"type": "image",
"attr": "img",
"title": "Product Image",
"options": {"x_scale": 0.27, "y_scale": 0.25},
},
("name", "Name"),
("desc", "Description"),
("price", "Price"),
("created_at", "Create Time"),
]
sheet = Sheet(
root=Table(
data=data,
columns=columns,
row_height=80,
cell_style={
"color: red": lambda record, col: col.attr == "price" and record.price > 50
},
date_format="yyyy-mm-dd",
align="center",
border=1,
)
)
sheet.write("table.xlsx")
```

See how simple it is to create complex tables? You just wrote a dynamic Excel table with conditional formatting a few lines of code!
### Features
* 🎉 Declarative: Create Excel files with a simple, intuitive DSL.
* 🔥 Fast: Export large Excel files in seconds.
* 🚀 Flexible Layouts: Create any layout you can imagine with our intuitive Row and Col primitives.
### Documentation
For more details, check our comprehensive [Documentation](https://ryanwang520.github.io/poi/)
Raw data
{
"_id": null,
"home_page": null,
"name": "poi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "xlsx, xlswriter, excel, declarative",
"author": "Ryan Wang",
"author_email": "Ryan Wang < hwwangwang@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/5d/46/23a55b5a8941a686970d63f868d602d77cca19349f750fcec2692c812a16/poi-1.2.3.tar.gz",
"platform": null,
"description": "# Poi: The Declarative Way to Excel at Excel in Python\n\n\n\n## Why Poi?\n\nCreating Excel files programmatically has always been a chore. Current libraries offer limited flexibility, especially when you need more than a basic table. That's where Poi comes in, offering you a simple, intuitive, yet powerful DSL to make Excel files exactly the way you want them.\n\n\n\n## Installation\n\n```bash\npip install poi\n```\n\n## Quick start\n\n### Create a sheet object and write to a file.\n\n```python\nfrom poi import Sheet, Cell\nsheet = Sheet(\n root=Cell(\"hello world\")\n)\n\nsheet.write('hello.xlsx')\n```\n\n\n\nSee, it's pretty simple and clear.\n\n\n### Create a Dynamic Table with Conditional Formatting\n\n\n```python\nfrom typing import NamedTuple\nfrom datetime import datetime\nimport random\n\nfrom poi import Sheet, Table\n\n\nclass Product(NamedTuple):\n name: str\n desc: str\n price: int\n created_at: datetime\n img: str\n\n\ndata = [\n Product(\n name=f\"prod {i}\",\n desc=f\"desc {i}\",\n price=random.randint(1, 100),\n created_at=datetime.now(),\n img=\"./docs/assets/product.jpg\",\n )\n for i in range(5)\n]\ncolumns = [\n {\n \"type\": \"image\",\n \"attr\": \"img\",\n \"title\": \"Product Image\",\n \"options\": {\"x_scale\": 0.27, \"y_scale\": 0.25},\n },\n (\"name\", \"Name\"),\n (\"desc\", \"Description\"),\n (\"price\", \"Price\"),\n (\"created_at\", \"Create Time\"),\n]\nsheet = Sheet(\n root=Table(\n data=data,\n columns=columns,\n row_height=80,\n cell_style={\n \"color: red\": lambda record, col: col.attr == \"price\" and record.price > 50\n },\n date_format=\"yyyy-mm-dd\",\n align=\"center\",\n border=1,\n )\n)\nsheet.write(\"table.xlsx\")\n```\n\n\n\n\nSee how simple it is to create complex tables? You just wrote a dynamic Excel table with conditional formatting a few lines of code!\n\n\n### Features\n\n* \ud83c\udf89 Declarative: Create Excel files with a simple, intuitive DSL.\n* \ud83d\udd25 Fast: Export large Excel files in seconds.\n* \ud83d\ude80 Flexible Layouts: Create any layout you can imagine with our intuitive Row and Col primitives.\n\n\n### Documentation\n\nFor more details, check our comprehensive [Documentation](https://ryanwang520.github.io/poi/)\n",
"bugtrack_url": null,
"license": null,
"summary": "Write Excel XLSX declaratively.",
"version": "1.2.3",
"project_urls": null,
"split_keywords": [
"xlsx",
" xlswriter",
" excel",
" declarative"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "93982bc404e512d035bc697ddbd37c2e2414decee97dfb8f27e255410d32e365",
"md5": "f5631c1311a353f8b24562b0b09ae8a8",
"sha256": "e4fde15373bf330f33f7253b303e1856dbffd1c4a2f61cd190ca846aa5981c70"
},
"downloads": -1,
"filename": "poi-1.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f5631c1311a353f8b24562b0b09ae8a8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12277,
"upload_time": "2025-08-06T13:27:43",
"upload_time_iso_8601": "2025-08-06T13:27:43.070471Z",
"url": "https://files.pythonhosted.org/packages/93/98/2bc404e512d035bc697ddbd37c2e2414decee97dfb8f27e255410d32e365/poi-1.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5d4623a55b5a8941a686970d63f868d602d77cca19349f750fcec2692c812a16",
"md5": "6ef2b9ce03476cbd930776fa3ba8c89c",
"sha256": "bf7dd6b64d8e1320c5ef34ecab467dd59f143291c9f2f21be54357f0f98a97e3"
},
"downloads": -1,
"filename": "poi-1.2.3.tar.gz",
"has_sig": false,
"md5_digest": "6ef2b9ce03476cbd930776fa3ba8c89c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9751,
"upload_time": "2025-08-06T13:27:44",
"upload_time_iso_8601": "2025-08-06T13:27:44.245183Z",
"url": "https://files.pythonhosted.org/packages/5d/46/23a55b5a8941a686970d63f868d602d77cca19349f750fcec2692c812a16/poi-1.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-06 13:27:44",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "poi"
}