AI Schema Detection: Automate Workflows with LLM APIs

Call an LLM API from Excel, get structured JSON back, and use it to drive a Python EDA. Gemini or any model on OpenRouter, with xlwings Lite.

Download Excel (.xlsx) Watch Video Guide

What This App Does

#

Connect Excel directly to LLM APIs for AI-powered analysis:

  • Gemini (free tier available) or any model on OpenRouter: type the model name in a cell
  • Schema detection with structured JSON output: the LLM's answer follows a JSON schema set in the code
  • Identify categorical and numerical variables
  • Generate PostgreSQL data types and a description per column
  • Python EDA driven by the detected schema: statistics, value counts, correlations
  • Charts: histogram and box plot per numeric column, bar chart per categorical column

API keys stay out of the workbook

Keys are read from xlwings Lite environment variables with Local scope. They are kept in your browser and are not saved in the file.

How to Use

#
  1. Download & open: get the workbook and open xlwings Lite (Home > Add-ins). The HOW_IT_WORKS sheet explains every step; the buttons are on the MASTER sheet.
  2. Add an API key: in xlwings Lite, Settings > Environment Variables, add GEMINI_API_KEY (free at aistudio.google.com) or OPENROUTER_API_KEY (openrouter.ai), scope Local, then restart xlwings Lite
  3. Choose the table: RBICC (RBI bank-wise ATM, POS and card statistics) or RESP (bank marketing campaign), or any Excel table you add
  4. Detect the schema: click "1a. Detect Schema (Gemini)" or "1b. Detect Schema (OpenRouter)"; results go to the SCHEMA sheet
  5. Review: edit the categorical / numeric lists on SCHEMA if you disagree with the LLM
  6. Run the EDA: click "2. Run EDA"; output goes to DISTROS_<table> and PLOT_<table>

How It Works

#

LLM API Integration

  • Sends the header and first 10 rows of your table to the chosen LLM; the EDA runs on the full table inside Excel
  • Two calls in parallel: one for the categorical / numeric split, one for the PostgreSQL schema
  • Structured output: both answers follow a JSON schema, so the script reads them directly
  • Busy or temporary API errors are retried automatically

Automated Workflows

  • Detected schema configures EDA operations
  • Numeric columns: statistical analysis
  • Categorical columns: frequency distributions
  • Enables automation of database operations

Practical Use Cases

  • Web scraping with structured output
  • Text classification and summarization
  • Text-to-SQL with Excel frontend
  • Data preparation for database uploads

Resources

xlwings Lite

Built with xlwings Lite

Created by Felix Zumstein, it brings Python into Excel seamlessly - enabling native support for databases, AI agents, LLMs, advanced analytics, ML, APIs, and complete automation workflows.

Bugs,issues,questions? Drop a note: amar@harolikar.com