← Back to all products
$19
Report Generator
Automated reporting tool generating polished HTML reports with KPI cards from JSON/CSV data.
MarkdownPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 10 files
report-generator/
├── LICENSE
├── README.md
├── examples/
│ └── sample_revenue.csv
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_input-format.md
│ └── 04_faq.md
├── index.html
└── src/
└── report_generator.py
📖 Documentation Preview README excerpt
Report Generator
Automated reporting tool: load data from JSON/CSV, apply templates, and generate polished HTML reports with KPI cards, summary statistics, and data tables. Schedule with cron for hands-free reporting.
Features
- Three built-in templates — Summary, Detailed, and Table-Only for different needs
- Auto-detection — Identifies numeric columns and calculates summary stats automatically
- KPI extraction — Surfaces revenue totals, rate averages, and row counts as headline cards
- Dark theme — Professional dark UI matching the Analytics Hub brand
- Responsive tables — Data tables that work on desktop and mobile
- Column statistics — Count, total, mean, median, min, max, std dev for every numeric column
- Self-contained HTML — Single file output with embedded CSS
- CLI-friendly — Pipe into cron for scheduled reporting
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
# Generate a detailed report from CSV data
python src/report_generator.py --data examples/sample_revenue.csv --template detailed --title "Monthly Revenue"
# Summary report (KPIs + stats, no raw data table)
python src/report_generator.py --data examples/sample_revenue.csv --template summary
# Table-only report (just the data)
python src/report_generator.py --data data.json --template table-only --output /tmp/report.html
# Custom title and subtitle
python src/report_generator.py --data data.csv --title "Q1 2026 Report" --subtitle "Acme Corp Analytics"
Templates
| Template | Contents | Best For |
|---|---|---|
summary | KPI cards + column statistics | Executive summaries, dashboards |
detailed | KPIs + stats + full data table | Complete reports, audits |
table-only | Just the data table | Quick data exports, embedding |
Input Format
Any JSON array or CSV file with consistent columns:
month,revenue,customers,churn_rate
2026-01,42500,185,2.1
2026-02,45800,201,1.8
2026-03,48200,218,1.5
Scheduling with Cron
# Generate daily report at 6 AM
0 6 * * * python /path/to/report_generator.py --data /path/to/data.csv --template summary --output /var/www/reports/daily.html
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .py preview
src/report_generator.py
#!/usr/bin/env python3
"""
Report Generator — Analytics Hub (DataNest)
Automated reporting tool: load data from JSON/CSV, apply templates, and
generate polished HTML reports with tables, summary stats, and charts.
Schedule with cron for hands-free reporting.
Usage:
python report_generator.py --data sales.csv --template summary --output report.html
python report_generator.py --data metrics.json --template detailed --title "Q1 Report"
python report_generator.py --data data.csv --template table-only --output /tmp/report.html
Dependencies: Python 3.10+ stdlib only (no pip packages)
License: MIT
"""
from __future__ import annotations
import argparse
import csv
import json
import logging
import statistics
import sys
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
logger = logging.getLogger("report_generator")
# ---------------------------------------------------------------------------
# Data models
# ---------------------------------------------------------------------------
@dataclass
class ColumnStats:
"""Summary statistics for a single numeric column."""
name: str
count: int = 0
total: float = 0.0
mean: float = 0.0
median: float = 0.0
min_val: float = 0.0
max_val: float = 0.0
stdev: float = 0.0
@dataclass
class ReportData:
# ... 325 more lines ...