Skip to main content

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() 

TODO

  • Parameters should have an option to provide a name. Such parameter shuld than be referenced by name in formulas. There should be a unique-ness check.
  • Check rules for parameter names.
  • Add themes: The user would pick a theme and it would style tables and values accordingly.
  • Support for directly touching the xlsxwriter API.
  • Support for hooks. Such that user can override internal data structures at any step of the process.
  • Bug: There is an extra parenthesis in for example =IF((B1>0),1,0) which should not be there.

Metadata

Release files for gridient 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gridient 0.1.3
File Size Uploaded
gridient-0.1.3.tar.gz 45.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gridient 0.1.3
File Interpreter ABI Platform
gridient-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 67.7 kB

Release files / gridient-0.1.3.tar.gz

Download URL gridient-0.1.3.tar.gz
Size 45.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1c91ebcd10e609225da629a0c4ac8362840bee2310bc32f2da0ef5c91e671140
BLAKE2b-256 checksum
How to use checksums
ecf10a208f97390c343e088252a7493b644cc28cae53b439053599e0ab0b9626
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / gridient-0.1.3-py3-none-any.whl

Download URL gridient-0.1.3-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8818eb8997edc328519c25f4db70215a78352d023f9682e0b2405b54ec317ace
BLAKE2b-256 checksum
How to use checksums
0a2138dd80af983b12ef524e3f1c93e31af6e562f0eca0693cd0b2062e6ceeb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page