# Spreadsheet quality lab

Original synthetic data; no real customers or business outcomes. Use the included
`spreadsheet-quality.xlsx` or import the CSV files deliberately through a text/CSV
connector. Opening CSVs directly can cause unwanted automatic type conversion.

Rebuild with `python 11-Blog-Programme/labs/spreadsheet-quality/build_and_verify.py`.
The generator needs Python and openpyxl. It checks reference arithmetic and workbook
structure, but does not execute Excel, PivotTables or Power Query. Review those
interactions in your target Excel version before publication. XLOOKUP examples
target an Excel edition supporting XLOOKUP; formula separators can vary by locale.

## Data contract

- One invoice line per LineID after replay handling. InvoiceID legitimately repeats.
- Raw data: eight rows, including an identical repeated delivery of L03. Under this
  fixture's explicit contract, retain one L03 in the clean seven-line output.
- Customer IDs are text, including leading zeros. Customer 0042 has contradictory
  region records in the reference table. Customer 0099 is absent. Neither issue is
  silently resolved in the clean sales table.
- Dates use YYYY-MM-DD in CSV; Clean_Lines uses actual date cells in XLSX.
- Amounts are integer paise. NetPaise = Quantity * UnitPricePaise - DiscountPaise;
  the discount applies once per line. Raw category labels remain alongside mapped
  categories. L07's Unknown label becomes Unmapped, not an invented category.
- January paid population: four lines, three invoices, 47,500 paise. Software
  contributes 29,000 and Training 18,500. Including pending January activity gives
  55,500. All clean dates/statuses total 72,500; raw replay-inclusive total is 82,500.

Tables in the workbook: RawSales, Sales, Customers and CategoryMap. Reference_Controls
contains Python-calculated expected values, not cached Excel evaluation. Blank_Tests
includes a true blank, a formula returning an empty string, zero and a space.

`monthly-inputs/` contains January (five clean lines, 55,500 paise) and February
(two lines, 17,000 paise) XLSX exports with a `SalesExport` table. Combine only this
folder for the valid append exercise. `schema-failure-example/` separately contains
an intentionally incompatible NetRupees column; do not silently combine it with
NetPaise. The generator checks valid header equality and detects the bad header.

Exercises deliberately expose data defects. Do not use the conflicted customer
table as an authoritative region mapping until the conflict is resolved.
Original fixture/code may be used, modified and redistributed for learning with
attribution to NeuraPath Academy.
