8000 GitHub - GusFurtado/cellmate: cellmate is a Python package for creating and managing styled Excel spreadsheets using OpenPyXL
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

GusFurtado/cellmate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cellmate

cellmate is a Python package for creating and managing styled Excel spreadsheets using OpenPyXL. It provides high-level abstractions such as Style, Column, Sheet, and Workbook to simplify Excel operations while allowing for extensive customization and formatting.

Features

  • Reusable Styles: Define and apply consistent styles across cells, columns, and sheets.
  • Column Management: Create structured and styled columns with titles and content.
  • Sheet Creation: Build sheets with multiple columns, complete with styles and formatting.
  • Workbook Handling: Manage multiple sheets within a single workbook and save them to Excel files.
  • Built-in Styles: Use predefined styles for common formats such as currency, percentage, and dates.

Getting Started

Installation

Ensure you have Python 3.8 or later installed on your system. After that, you can install cellmate via pip:

pip install cellmate

Example Usage

Here's an example of how to create a styled Excel workbook using Cellmate:

import cellmate as xl
from cellmate import styles

# Define columns with data and styles
columns = [
    xl.Column(
        title="Product",
        content=["Apples", "Bananas", "Cherries"],
        title_style=styles.TITLE1,
        content_style=styles.DEFAULT
    ),
    xl.Column(
        title="Sales",
        content=["100", "200", "150"],
        title_style=xl.TITLE1,
        content_style=xl.Style(name="currency", number_format="$ #,##0.00")
    ),
    xl.Column(
        title="Growth",
        content=["0.05", "0.10", "0.07"],
        title_style=styles.TITLE1,
        content_style=styles.PERCENTAGE
    )
]

# Create a sheet and a workbook
sheet = xl.Sheet(data=columns, sheet_name="Summary")
workbook = xl.Workbook(sheets=[sheet])

# Save the workbook
workbook.save("example.xlsx")

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.

About

cellmate is a Python package for creating and managing styled Excel spreadsheets using OpenPyXL

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages

0