Inspiration
In today's data-driven world, people need quick, meaningful insights from their spreadsheets. However, traditional data analysis requires either technical SQL/Python knowledge or uploading sensitive files—such as financial records, company metrics, or private user data—to cloud-based LLM providers. Sending proprietary data to external APIs is a massive privacy risk that many organizations simply cannot take.
The inspiration for Excel Analytics Chatbot came from wanting to eliminate this dilemma. I wanted to build a powerful, "privacy-first" data analyst assistant that gives users the power of advanced natural language data querying, semantic text search, and chronological trend forecasting, while running 100% offline on a standard laptop.
What it does
Excel Analytics Chatbot allows users to drop in any Excel or CSV file and converse with their data naturally. Instead of relying on a single generic prompt template, the system features an intelligent Smart Router that dynamically analyzes the user's intent and matches it with the ideal analytical processing engine:
Quantitative Insights: Converts questions like "What is the average rating?" or "Top 10 records by score" into optimized SQL queries executed instantly against the dataset.
Text & Pattern Analysis: Groups qualitative data (like open-ended customer feedback or bug reports) into semantic clusters to identify overarching themes and common complaints.
Time-Series Trends: Extracts and parses dates to chart variations, growth velocity, and recurring temporal patterns over months or years.
Semantic Search (RAG): Surfaces deep qualitative context using vector retrieval when the user asks nuanced questions like "Why are customers unhappy?"
To ensure absolute security and multi-tasking capability, the application isolates data into distinct, containerized user sessions. Multiple files can be analyzed concurrently in different conversations without any underlying data leakage.
How we built it
The core engine is built using Python, relying entirely on an ecosystem of high-performance, open-source local libraries and models.
Data Architecture Instead of loading massive dataframes entirely into memory, uploaded files are immediately ingested into DuckDB, an in-process, columnar database engine designed for lightning-fast analytical queries (OLAP). This acts as the structured query foundation for our application.
The AI Brain The application handles semantic reasoning and natural language generation completely offline:
LLM Interface: Orchestrated via Ollama, utilizing local instances of compact parameter models like llama3:8b or mistral:7b.
Embedding Pipeline: Text vectors are derived locally using sentence-transformers (specifically the all-MiniLM-L6-v2 model).
Vector Database: Generated embeddings are indexed inside a local FAISS index for rapid semantic similarity lookups during Retrieval-Augmented Generation (RAG).
Algorithmic Clustering For qualitative summaries where an LLM prompt might easily hit context window limits, the data is pushed through a Scikit-learn pipeline. Text fields are tokenized, vectorized, and parsed using unsupervised clustering algorithms to isolate the core recurring concepts mathematically before presenting them to the LLM.
Challenges we ran into
Small LLM Determinism and Hallucinations The most significant hurdle was relying on smaller-scale local models (8B parameters or less). Unlike monolithic cloud APIs, smaller models are highly prone to syntax errors when generating structured code like SQL.
To combat this, I designed a rigid 3-attempt automatic self-healing retry mechanism. Every SQL query generated is verified against the DuckDB parser under the hood. If an execution fails, the traceback is captured and fed back to the LLM as an iterative correction sequence:
New Prompt = Previous Prompt + Syntax Error Log
This allows the model to heal its own code automatically before the user encounters an error message.
State Persistence Managing isolated states across concurrent sessions without a standard server-client database was difficult. We addressed this by engineering a modular directory matrix where every unique conversation ID spins up a separate database binary: db_path = f"data/sessions/session_{session_id}.duckdb" conn = duckdb.connect(db_path)
Accomplishments that we're proud of
Absolute Privacy: We successfully established a robust data analytics pipeline that processes large tabular files with absolutely 0 external network API calls.Smart Query Routing: The accuracy of the intent router is a massive win. It accurately distinguishes between a mathematical question needing strict SQL math and a semantic question needing vector search.Real Analysis Validation: The system guarantees data-driven answers. It filters out generic LLM fabrications, forcing the chatbot to back up every summary statement with actual database aggregates.
What we learned
Building this project underscored how much performance can be extracted from localized hardware when open-source components are tightly integrated. I gained a deep appreciation for DuckDB's efficiency compared to traditional Pandas loops when processing multi-megabyte datasets on constrained resources.
More importantly, I mastered the art of advanced local prompt engineering. I learned that guiding smaller LLMs requires highly strict role constraints, explicit schema mappings, and structured JSON output definitions to achieve production-grade reliability.
What's next for Excel Analytics Chatbot
The roadmap for scaling the local chatbot focuses on expanding performance and multimodal output:
Local Data Visualization: Integrating automated script execution via Matplotlib/Seaborn so the chatbot doesn't just explain data trends, but renders local PNG charts and graphs directly into the conversation.
Enhanced Embedding Models: Providing an optional config toggle to upgrade from all-MiniLM-L6-v2 to higher-dimensional models like all-mpnet-base-v2 for complex, domain-specific terminology.
Advanced Data Profiling: Implementing automated correlation matrices and anomaly detection algorithms during the initial ingestion phase, alerting users to hidden data skews automatically.
Built With
- duckdb
- faiss
- javascript
- ollama
- pandas
- python
- scikit-learn
- sentence-transformers
Log in or sign up for Devpost to join the conversation.