This script converts labeled transaction data from CSV into a multi-sheet Excel report with summaries and charts.
It builds on PyFi’s new AI for Finance demo, extending it into a full reporting pipeline that exports a polished Excel workbook with embedded visualizations and summary statistics.
PyFi’s AI for Finance demo executes logic technically impossible in Excel, injects intelligence into the workflow via the OpenAI API, and automates a multi-hour financial analysis, in just a few seconds.
This project takes the output of that demo and produces a stakeholder-ready Excel report:
- Raw labeled data
- Human-readable summaries
- Embedded chart images
- Native Excel charts built directly from the data
This makes it suitable for finance, ops, or audit-style reporting workflows.
Output workbook (example: labeled_data.xlsx) includes:
Full import of labeled_data.csv produced by the PyFi demo pipeline.
If these files exist, they are added as formatted sections:
summary.csv- expected column:
Summary
- expected column:
summary_stats.csv- expected columns:
Metric,Value
- expected columns:
Embeds pre-rendered PNG charts:
spending_by_spender.pngspending_by_category.pngspending_by_vendor.png
Charts are scaled and positioned side-by-side with titles.
Creates Excel-native charts from aggregated data:
- Pie — Spending by Spender
- Pie — Spending by Category
- Bar (top 15) — Spending by Vendor
All charts are generated directly inside Excel using openpyxl.
labeled_data.csv(from PyFi demo output)
Expected columns:
amountspendercategoryvendor
summary.csvsummary_stats.csv- PNG chart files listed above
pip install pandas openpyxl