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.1.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.1-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gridient-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 947d593137917be68a6abf3db699bed9d54218a22d42b1f5c902e261b2f3e128
MD5 b71fa9fb433db7cbc50ab939abdea48e
BLAKE2b-256 d2a523ab70925c13ae8e3e0f475e57a5a0f55ca3aed67e781747f17cffeeb72d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gridient-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bcbad1f43ce700d95cfba6090343d54adb42c2fa393923ba92b3448f69139e37
MD5 3812de1f182d27604409895b87cdb6d7
BLAKE2b-256 e79ea2e78cb3cbaab3b2b71bdc3d43f13757b399845cfc8c09333e55ea28c34e

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