An opinionated, production‑style automation for real financial reports. Give it a standard Excel workbook and it will rebuild the Summary sheet (twelve core ratios across three years, with norms and deltas) and write a ready‑to‑paste Word section for the report — clean table, short narrative, and risk flags. No screenshots, no hand‑tweaking: the same result, every time. This repository shows a small public slice of a deeper client workflow; numbers are anonymised — the method is the point.
Live page: https://irinatok11.github.io/fin-health-python/
- Overview
- Who this is for
- Quick start
- Key features
- How it works
- Design decisions
- Methodology
- Reference articles
- Project structure
- Getting started
- Input data requirements
- Demo: Before → After
- Formatting and code style
- Versioning
- Roadmap
- License
- Contact
- Excel Summary: 12 KPIs (across liquidity, financial stability and profitability).
- Word output: 4 liquidity KPIs (cash, current, quick, months to repay).
Two Word variants shown in the demo
- v1 — Python only: Word section exactly as generated by the script (table + narrative).
- v2 — Python + visuals: the same Word section after manually inserting Power BI charts in the narrative (for portfolio presentation).
Power BI linkage. The charts used in Word v2 are captured from the companion Power BI dashboard
(Page 2 — v2, flat/print) and inserted into the narrative for portfolio presentation.
Power BI portfolio: live https://irinatok11.github.io/fin-health-power-bi/ · repo https://github.com/IrinaTok11/fin-health-power-bi/
Audience. Executives, finance leads, and analysts who want consistent, low-friction reporting.
Tech stack. Python · pandas · openpyxl · python-docx
Sample workbook: the repository includes a small example Excel file with the Summary sheet already built, so you can see the output at a glance.
Built for executive leadership and finance leads who need consistent, audit-ready reporting — and for licensed insolvency practitioners (administrators, liquidators, CVA supervisors) and restructuring advisers who produce the same ratio tables repeatedly and want that work automated.
cd run
python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate
pip install -r ../requirements.txt
python summary.pyResult: the Excel workbook in run/ gets its Summary sheet updated, and the Word file 3.2_analysis_of_liquidity_ratios.docx appears in run/.
- One-click pipeline: Calculates ratios → writes a clean Summary sheet (Excel) → creates a Word section with title, caption, table, narrative, flags, and recommendations.
- Norm-aware benchmarks: Uses
ratio_normssheet (“between / higher / lower”, low/high bounds, units) to show proper Benchmark text and symbols (≤, ≥, ranges). - Trends and deltas: Adds ↑/↓/→ and the absolute change (Change) across the three most recent years.
- Robust structure checks: Enforces the presence of required sheets/columns and at least 3 years — reduces human mistakes.
- Corporate styling by default: Font (Calibri), paddings, column widths, caption, spacing — no manual polishing needed.
- Narrative automation: Generates “Overall assessment”, “Key observations” and “Recommended actions” for the liquidity subset (4 KPIs).
The script looks for exactly one .xlsx in the current working directory. It reads the required sheets, computes metrics (12 total), builds a Summary dataframe, rewrites the Summary sheet, and then saves a Word document named:
3.2_analysis_of_liquidity_ratios.docx
Scope note: Excel Summary shows 12 KPIs. The Word section 3.2 in this repo includes only 4 liquidity KPIs (cash, current, quick, months to repay).
Tip: Run it from the
run/folder so that the Excel is the only.xlsxin the working directory.
- Excel engine. I use
openpyxlfor read/write because it keeps number formats and conditional styles intact.xlsxwriteris brilliant for fresh files, but here I need to edit an existing workbook without breaking its look. - Word writer.
python-docxis sufficient and predictable for a short section with a single table and a few paragraphs; no templating engine is required, which makes the output deterministic. - Sheet and column matching. Sheet names and headers are matched in a case/space‑insensitive way (so
Summary,summary, orSummaryall resolve to the same target). This reduces edge‑case failures when the source file comes from different accountants. - Norms as data, not prose. Benchmarks live in
ratio_norms(withbetter_isand numeric bounds). The narrative then reads these values and decides the wording (≤, ≥ or ranges) instead of hard‑coding phrases. - Percentages as numbers. All percentage outputs remain numeric with an Excel
number_formatrather than pre‑formatted strings, so downstream tooling can still aggregate and chart. - Single source file. The pipeline expects one workbook in
run/. That constraint keeps the CLI simple and avoids accidental cross‑contamination.
A practitioner-focused write-up of the pipeline — why these KPIs, how the norms drive the narrative, and what the output is designed to replace — is published in HTML:
- Website: https://irinatok11.github.io/fin-health-python/methodology.html
- Repo file: docs/methodology.html
Supporting notes used across the project:
- Architecture (high‑level): docs/reference/architecture.md
- KPI catalogue: docs/reference/kpi_catalog.md
- Case study — Liquidity reporting in practice: docs/reference/case_study.md
fin-health-python/
├─ run/ # working folder (run the script here)
│ ├─ summary.py
│ ├─ integra_financial_analysis.xlsx
│ ├─ 3.2_analysis_of_liquidity_ratios.docx # appears after running
│ └─ README.md
├─ docs/ # GitHub Pages (live site content)
│ ├─ _config.yml
│ ├─ index.html # Landing page for the Python portfolio case
│ ├─ methodology.html # Methodology and reproducibility details
│ ├─ reference/ # Lightweight reference notes (Markdown)
│ │ ├─ architecture.md # System architecture / data flow overview
│ │ ├─ kpi_catalog.md # KPI catalogue (rules, norms, tests)
│ │ └─ case_study.md # Short case narrative
│ └─ assets/
│ ├─ css/
│ │ └─ portfolio.css # Global styles; hides nav links on ≤640px (logo only)
│ ├─ pipeline_overview.jpg # Pipeline diagram (Excel → Python → Word)
│ ├─ 00_summary_before.png # Screenshots: Summary sheet before/after
│ ├─ 01_summary_after.png
│ ├─ 02_word_v1_page1.png # Screenshots: Word v1 (Python only)
│ ├─ 03_word_v1_page2.png
│ ├─ 04_word_v2_page1.png # Screenshots: Word v2 (Python + Power BI visuals)
│ └─ 05_word_v2_page2.png
├─ demo/
│ └─ README.md # how to capture real screenshots
├─ .gitignore
├─ requirements.txt
├─ LICENSE
└─ README.md # this file
-
Create and activate a virtual environment
python -m venv .venv # Windows: .venv\Scripts\activate # macOS/Linux: source .venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Run from the
run/directorycd run python summary.py -
Check the results
- The Excel workbook in
run/now has an updated, formatted Summary sheet. - A Word file
3.2_analysis_of_liquidity_ratios.docxappears inrun/.
- The Excel workbook in
If you use a different workbook, place it into
run/and ensure it is the only.xlsxthere when running the script.
Sheets expected (case-insensitive; underscores/spaces are normalized):
years: first column contains the years (e.g., 2021, 2022, 2023). At least 3 years are required.parameters: two columns —Parameter,Value(may includecompany_name).income_statement: must include aVariablecolumn and year columns (e.g.,2021,2022,2023).balance_sheet: same requirements asincome_statement.ratio_norms: columns —ratio_key,better_is(between|higher|lower), optionalnorm_low,norm_high, andunit.
Ratios computed (12): Cash ratio, Current ratio, Quick ratio, Months to repay, Equity ratio, Debt-to-equity, Working capital, ROA, ROE, Net profit margin, EBITDA margin, Altman index.
Visuals policy: Power BI visuals are not stored in this repo.
| Summary — before | Summary — after (generated) |
|---|---|
![]() |
![]() |
| Page 1 | Page 2 |
|---|---|
![]() |
![]() |
For portfolio presentation, Word v2 is the same section after manually inserting charts captured from the companion Power BI dashboard (Page 2 — v2, flat/print) — same numbers, different presentation.
Power BI: live — irinatok11.github.io/fin-health-power-bi · repo — github.com/IrinaTok11/fin-health-power-bi
| Page 1 | Page 2 |
|---|---|
![]() |
![]() |
This is a small production script, so I keep the toolchain light. If you want the same formatting I use:
# Optional, but recommended
pip install black ruff
# Format
black .
# Lint (fast default rule set)
ruff check .Single‑file utility, semantic-ish versioning in the header:
__author__ = "Irina Tokmianina"
__version__ = "0.1.0"I bump the minor when outputs change shape; the patch when wording/formatting is tweaked.
- Configurable output directory (not only CWD).
- Optional CSV export of Summary.
- CLI flags (e.g.,
--excel PATH,--company NAME,--no-word). - Unit tests and CI smoke checks.
This project is available under the MIT License. See LICENSE.
IRINA TOKMIANINA — Financial/BI Analyst
LinkedIn: linkedin.com/in/tokmianina · Email: irinatokmianina@gmail.com






