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.1.tar.gz (6.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.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for excelipy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cdade8720fc9c593cbd80dac4e3fbb8be3f60d859d0e7b450b81decf008e12c3
MD5 7c399f54dd131dad669c3d0c56fd8463
BLAKE2b-256 962e5ffbb32b2073be41e3be4f9d6ebb9564d0192e18d2a0037ea0876ff45ddb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for excelipy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f33ad60a01a6a7eac43b303c20cbb7a8febddcecdae61d454d1480d18b9e9979
MD5 c3ad214000e14df2fa14602c2446890c
BLAKE2b-256 2afe48054f93f52e59091b2b3d23b294ed7864f8abb15ce916b4376ecf2eff02

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