# Colab 03: Excel Visualization This OpenRath v2.0.0 example turns a fixed sales CSV into an editable Excel workbook with formulas, KPIs, charts, previews, and automated quality checks. It demonstrates how a router can block bad input before any artifact is built. [Open in Google Colab](https://colab.research.google.com/github/Rath-Team/example/blob/main/examples/03_excel_visualization/notebook.ipynb) · [View the workflow source](https://github.com/Rath-Team/example/blob/8db4d409e716458cea3040b905769a1222cb26e5/examples/03_excel_visualization/src/workflow.py) · [View the reference workbook](https://github.com/Rath-Team/example/blob/8db4d409e716458cea3040b905769a1222cb26e5/examples/03_excel_visualization/output/sales-dashboard.xlsx) ## Input and Output | Input | Output | | --- | --- | | `sales.csv` with 24 typed sales rows across six months and four regions. | `output/sales-dashboard.xlsx` | The generated workbook contains four worksheets: | Worksheet | Contents | | --- | --- | | `Data` | The typed source rows in an Excel table. | | `Calculations` | Visible regional, monthly, gross-profit, and return-rate formulas. | | `Dashboard` | Four KPIs plus regional and monthly charts. | | `Notes` | Purpose, traceability, generation, and security notes. | ## Workflow | Node | What happens | | --- | --- | | `profile_data` | Counts missing cells and duplicate business keys, then computes the source profile. | | `quality_route` | Sends clean data to planning or routes invalid data to `stop_for_quality`. | | `plan_dashboard` | Requests validated presentation text while preserving program-computed values. | | `build_workbook` | Builds the four-sheet XLSX and four visual previews. | | `qa_and_register` | Rejects missing previews or Excel formula errors before publishing the artifact. | The LLM supplies only bounded presentation wording. Revenue, orders, return rate, region totals, month totals, KPI formulas, and chart data all come from the CSV and deterministic workbook builder. ## Quality Routing ```python @router(successors=("plan_dashboard", "stop_for_quality")) def quality_route(self, state): return ( "plan_dashboard" if state["profile"]["quality"] == "pass" else "stop_for_quality" ) ``` For this example, data quality passes only when rows exist and both missing cells and duplicate business keys equal zero. A blocked dataset never reaches the LLM planning or workbook-build steps. ## Run and Verify 1. Open the Notebook in Google Colab. 2. Choose **Runtime → Run all**. 3. Enter the DeepSeek API key in the masked prompt. 4. Review the dashboard preview and download the workbook. The Notebook verifies: - the durable run finishes as `SUCCEEDED`; - the profile contains 24 rows and a `pass` decision; - all four worksheets have visual previews; - the formula audit finds no `#REF!`, `#DIV/0!`, `#VALUE!`, `#NAME?`, or `#N/A`; - five checkpoints are stored; - the workbook is registered under an `artifact://local/` URI. ## Adapt It Replace `sales.csv` while preserving the published column contract, or update the profiler and portable builder together for a new schema. Add new quality rules before `quality_route` so invalid data remains outside artifact-building steps.