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. Here is a simple example:

import logging
from pathlib import Path

import pandas as pd

import excelipy as ep


def main():
    df = pd.DataFrame(
        {
            "testing": [1, 2, 3],
            "tested": ["Yay", "Thanks", "Bud"],
        }
    )

    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)


if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG)
    main()

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:

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.2.tar.gz (6.8 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.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for excelipy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 91e73431ba391626c1952dffa1b900d1776cec4151d559ef3725736d3b5ac7e5
MD5 01fa1c90f195de868ae28080cb00200b
BLAKE2b-256 faf6217b95aa47fee5d128b7af6a9f89f428c6976029848f17524e79d4d1f134

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for excelipy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 229034a6ca80d2006af87c39a60eed1dd590ab608f15a1df27eba6db58a2da56
MD5 706f907fd58c68c45d68a302231cd4b1
BLAKE2b-256 d74743762f99926e55e691cfce41c098f3ead70ac83706237006c6597f00eef0

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