Skip to main content

A Python library for writing calculations to Excel while preserving formulas.

Project description

Gridient

A Python library designed to simplify writing complex calculations and data structures to Excel files while preserving the underlying formulas. Define your logic in Python using familiar operators and let Gridient translate it into live Excel formulas.

Features

  • Define calculations using Python operators (+, -, *, /).
  • Write Pandas DataFrames and Series.
  • Create parameter tables.
  • Apply cell styling (bold, italics, colors, etc.).
  • Use custom number formatting.
  • Organize output across multiple sheets using a layout system.
  • Best-effort column auto-width adjustment.

Installation

pip install -r requirements.txt
pip install .

Basic Usage (Conceptual)

import gridient as gr
import pandas as pd

# Define values and parameters
initial_investment = gr.ExcelValue("Initial Investment", 1000000, format="$#,##0")
discount_rate = gr.ExcelValue("Discount Rate", 0.05, format="0.00%")
params = gr.ExcelParameterTable("Parameters", [initial_investment, discount_rate])

# Perform calculations (these become Excel formulas)
revenue = gr.ExcelSeries.from_pandas(pd.Series([100, 150, 200]), name="Revenue")
profit = revenue * 0.2
profit.name = "Profit"
profit.format = "$#,##0"

# Create layout
workbook = gr.ExcelWorkbook("report.xlsx")
layout = gr.ExcelLayout(workbook)
sheet1 = gr.ExcelSheetLayout("Dashboard")

# Add components to layout
sheet1.add(params, row=1, col=1)
sheet1.add(profit, row=5, col=1)

# Add sheet to workbook layout and write
layout.add_sheet(sheet1)
layout.write() 

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

gridient-0.1.0.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

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

gridient-0.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file gridient-0.1.0.tar.gz.

File metadata

  • Download URL: gridient-0.1.0.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gridient-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8e01aad2ca689d9afb018875595fec03a9130a0e76f660c606e7da98cce6f1c5
MD5 184cf512a4a3acd2681c261b7d8bd8bf
BLAKE2b-256 d5a887ab1751da61de56e13f36317ad93343f8dbb0c62e09b1cbbb5b4a58de47

See more details on using hashes here.

File details

Details for the file gridient-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gridient-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gridient-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5685b00ec5f3cf98c6752a1e126da70ad2530f4561bf2e5822b376677d071314
MD5 a17465a9678f975678851e1316f425d1
BLAKE2b-256 fb2859c9a3652a9a9bda750320c272c6c2b288cc733284a9d4fb80e89b5fa5c4

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