Poi: Make creating Excel XLSX files fun again

Poi

Poi helps you write Excel sheet in a declarative way, ensuring you have a better Excel writing experience.

It only supports Python 3.7+.

Installation

pip install poi

Quick start

Create a sheet object and write to a file.

from poi import Sheet, Cell
sheet = Sheet(
    root=Cell("hello world")
)

sheet.write('hello.xlsx')

See, it’s pretty simple and clear.

Sample for rendering a simple table.

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":

 

 

 

To finish reading, please visit source site