# Xlookup Retail Sales Intelligence

> Automate Excel XLOOKUP enrichment across raw sales logs, product catalogs, and supplier tables—outputting QA reports, pivot workbooks, SQLite/PostgreSQL storage, and an interactive Plotly HTML dashboard.

Xlookup Retail Sales Intelligence is a paid AI agent skill on Agensi by nwafor lawrence, in Workflow Automation. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $8 (one-time purchase)
- Creator: [nwafor lawrence](https://www.agensi.io/creators/nwafor-lawrence)
- Category: [Workflow Automation](https://www.agensi.io/skills/workflow-automation)
- Version: 1.0
- Last updated: 2026-11-27
- Security: scan passed (2026-11-27); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/xlookup-retail-sales-intelligence
- Tags: automation, python, pandas, excel, retail, data-analysis

## About this skill

Stop wasting hours on fragile manual `XLOOKUP`/`VLOOKUP` formulas and spreadsheet cleanup. This skill automates the enrichment of raw retail transaction files (`.csv` or `.xlsx`) by joining them against product and supplier catalogs, calculating net revenue with discounts, and generating audit-ready Excel workbooks and an interactive HTML dashboard.

### What it does
- **Data enrichment** joins raw transaction files against a Product Lookup table (`Product_ID`) and optional Supplier Lookup table (`Supplier_ID`) to populate missing `Product_Name`, `Category`, `Unit_Price`, `Discount_%`, `Supplier_Name`, and `Country` fields.
- **Financial calculation** computes net `Total_Sales = Quantity * Unit_Price * (1 - Discount_% / 100)` while preserving existing numeric values.
- **Reporting automation** exports a currency-formatted `retail_sales_cleaned.xlsx` ledger alongside a 5-sheet `retail_sales_insights_report.xlsx` (`Data_Quality_Comparison` plus ranked summaries by Region, Product, Category, and Month).
- **Quality assurance** tracks exact `BEFORE` vs `AFTER` missing-field recovery counts so you can verify 100% lookup coverage.
- **Interactive visualization** generates a standalone dark-mode Plotly HTML dashboard (`retail_sales_dashboard.html`) with live Region & Category filters and KPI cards, plus an optional `streamlit_app.py` view.

### How it works
1. **Schema validation** checks raw sales and lookup files (`--validate-only`) to confirm required join keys and columns (auto-mapping aliases like `OrderID`, `TxnID`, `Qty`, `Price`, `Total`).
2. **Pipeline execution** runs `scripts/run_xlookup_pipeline.py` to deduplicate lookup keys, enrich missing columns, and calculate net revenue.
3. **Database loading** optionally writes the `retail_sales_cleaned` table to SQLite or PostgreSQL via `--db-url`.
4. **Export generation** writes `SalesTable.csv`, both formatted `.xlsx` workbooks, and `retail_sales_dashboard.html` into `--output-dir`.

### Frameworks & tools
Built with Python using `pandas` and `openpyxl` for ETL and Excel formatting, `SQLAlchemy` / `sqlite3` for SQL loading, and `Plotly` (plus optional `Streamlit`) for browser dashboards.

### Why this beats prompting it yourself
One-off prompts frequently break across mismatched header names, duplicate lookup rows, or Excel currency formatting. This skill runs a tested, deterministic CLI pipeline that validates schemas upfront and outputs consistent Excel reports and dashboards every time.

### Use cases
- **Transaction enrichment** when raw POS/ERP exports only log `Product_ID` and `Quantity` without names, categories, or unit prices.
- **Retail revenue audits** calculating net sales after item-level discount percentages across regions.
- **Stakeholder reporting** generating standalone interactive HTML dashboards with Before/After data-quality scorecards.
- **Database seeding** transforming incomplete `.csv` or `.xlsx` exports into a structured SQL `retail_sales_cleaned` table.

### Known limitations
Requires Python with `pandas`, `openpyxl`, and `SQLAlchemy` installed via `requirements.txt` (`streamlit` and `plotly` optional for Streamlit mode). Raw input files must include `Transaction_ID`, `Date`, `Product_ID`, `Quantity`, and `Region` columns, and the HTML dashboard fetches Plotly.js from CDN when opened in a browser.

## Requires

- Python 3.10+
- pandas = 2.0.0
- openpyxl = 3.1.0
- SQLAlchemy = 2.0.0
- Local filesystem read/write
- Optional: Streamlit (for live UI app)
- Optional: Plotly (for Streamlit charts
- Optional: PostgreSQL or SQLite database

Raw sales files need 5 columns: Transaction_ID, Date, Product_ID, Quantity, and Region (OrderID/TxnID/Qty map automatically). Run pip install -r requirements.txt first, then run --validate-only to check Product_Lookup join keys.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Xlookup Retail Sales Intelligence skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What core retail problems does this skill solve?

This skill automates the joining of raw transaction data with product catalogs using XLOOKUP logic, calculates net revenue after discounts, and generates interactive HTML and Excel reporting assets.

### What are the technical requirements for running this skill?

The skill is built for Python-based AI agents and requires `pandas`, `openpyxl`, and `Plotly` libraries to be installed in your environment.

### Do my input spreadsheets need to follow a specific format?

Yes, your raw sales and lookup files must contain a matching `Product_ID` column to ensure the enrichment pipeline can accurately join the datasets.

### Why should I use this skill instead of just asking an LLM to clean my data?

Unlike generic prompts that often hallucinate data or lose formatting, this skill uses a hardened pipeline with schema validation to ensure data integrity and complex multi-sheet Excel output.

### What is included in the purchase?

You will receive the complete Python-based skill logic, configuration templates for your data schemas, and documentation on how to integrate the tool with your existing database or file system.

### What types of reporting files does the skill output?

The skill generates a formatted multi-sheet Excel workbook with pivot tables, a cleaned flat CSV, and a standalone interactive HTML dashboard for browser-based KPI analysis.

### What if my raw sales spreadsheet already has some prices or totals filled in?

Existing numeric values are preserved (combine_first), while only blank Product_Name, Category, Unit_Price, Discount_%, or Total_Sales cells are populated from your lookup tables and computed net of discount.

### Do I need a Supplier Lookup table to run the skill?

No—--supplier-lookup is optional. If omitted, Supplier_Name and Country safely default to Unknown, and all product enrichment, Excel QA workbooks, and dashboard charts still run cleanly.

### Can I view the outputs without running Streamlit?

Yes. Both retail_sales_cleaned.xlsx and the 5-sheet retail_sales_insights_report.xlsx are native Excel workbooks, and retail_sales_dashboard.html opens directly in any web browser. streamlit run streamlit_app.py is purely optional.

### How are duplicate Product_ID rows handled in the lookup table?

The pipeline deduplicates lookup tables on Product_ID (and Supplier_ID) keeping the first matching row, preventing accidental row multiplication during joins.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
