Skip to main content

Wrapper around xlsxwriter to improve usability

Project description

Excelipy

codecov

Installation

You can install the package using pip:

pip install excelipy

Usage

The idea for this package is for it to be a declarative way of using the xlsxwritter. It allows you to define Excel files using Python objects, which can be more intuitive and easier to manage than writing raw Excel files.

Simple Example

import excelipy as ep

sheets = [
    ep.Sheet(
        name="Hello!",
        components=[
            ep.Text(text="Hello world!", width=2),
            ep.Fill(width=2, style=ep.Style(background="#33c481")),
            ep.Table(data=df),
        ],
        style=ep.Style(padding=1)
    ),
]

excel = ep.Excel(
    path=Path("filename.xlsx"),
    sheets=sheets,
)

ep.save(excel)

Result:

simple_example.png

Working with images

You can also add images to your Excel sheets. Auto-

import excelipy as ep

sheets = [
    ep.Sheet(
        name="Hello!",
        components=[
            ep.Image(
                path=Path("resources/img.png"),
                width=2,
                height=5,
                style=ep.Style(border=2),
            ),
        ],
    ),
]

excel = ep.Excel(
    path=Path("filename.xlsx"),
    sheets=sheets,
)

ep.save(excel)

Result:

image_example.png

Advanced Example

import excelipy as ep

sheets = [
    ep.Sheet(
        name="Hello!",
        components=[
            ep.Text(
                text="This is my table",
                style=ep.Style(bold=True),
                width=4,
            ),
            ep.Fill(
                width=4,
                style=ep.Style(background="#D0D0D0"),
            ),
            ep.Table(
                data=df,
                header_style=ep.Style(
                    bold=True,
                    border=5,
                    border_color="#F02932",
                ),
                body_style=ep.Style(font_size=18),
                column_style={
                    "testing": ep.Style(
                        font_size=10,
                        align="center",
                    ),
                },
                column_width={
                    "tested": 20,
                },
                row_style={
                    1: ep.Style(
                        border=2,
                        border_color="#F02932",
                    )
                },
                style=ep.Style(padding=1),
            ).with_stripes(pattern="even"),
        ],
        style=ep.Style(
            font_size=14,
            font_family="Times New Roman",
            padding=1,
        ),
    ),
]

excel = ep.Excel(
    path=Path("filename.xlsx"),
    sheets=sheets,
)

ep.save(excel)

This is an exaggerated example, to show the capabilities of the package. You can see that for a table, you can define the header style, body style, column styles, row styles, and even the column widths. You can also add text and fill components to the sheet.

This is the result:

advanced_example.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

excelipy-0.1.4.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

excelipy-0.1.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file excelipy-0.1.4.tar.gz.

File metadata

  • Download URL: excelipy-0.1.4.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for excelipy-0.1.4.tar.gz
Algorithm Hash digest
SHA256 970777cc71a48e15f284bf7f89aeb6f129b323e5d11a8536a8f15a5d030ede4d
MD5 e595aa8145304224c0fa1eb88cad58f7
BLAKE2b-256 2e7a4aa1aad35eea82e42211e26a0c3e120a0ec0e6335fabacc59f8e0e74f9b5

See more details on using hashes here.

File details

Details for the file excelipy-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: excelipy-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.19

File hashes

Hashes for excelipy-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 56186b0437670c7ec2885fa6033981c21e08857128284342408c914853026b4e
MD5 e54e44bb29b9148f4c43843503fed994
BLAKE2b-256 fb15c4d4df4c1b8e465ebebaa354ec30ca90411c84005ecbe0732b2e47a864ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page