excel-ai-assistant is a local Microsoft Excel Office Add-in MVP with a React + TypeScript task pane and a Python FastAPI backend. The add-in reads the selected Excel range through Office.js, sends safe spreadsheet context to the backend, routes requests across OpenAI, a local Ollama model, or deterministic fallback logic, and writes results back to Excel only through deterministic Office.js actions.
- Excel task pane add-in with Office.js selection reading
- Safe range profiling with headers, metadata, and sampled rows only
- Hybrid LLM routing:
autoopenailocalfallback
- Formula assistant:
- generate
- explain
- fix
- safe insert into one selected cell only
- Safe cleaning workflow:
- plan cleaning actions
- apply deterministic cleaning to a new sheet only
- optional issues sheet
- Report generation to task pane and new sheet
- Basic summary sheet creation
- Backend-only secret handling
- Frontend: React + TypeScript + Office.js task pane
- Backend: FastAPI
- LLM router:
- OpenAI provider
- Ollama local provider
- deterministic fallback provider
- Workbook writes:
- deterministic Office.js functions only
See docs/ARCHITECTURE.md and docs/FRONTEND_UI.md.
- Windows with Microsoft Excel desktop
- Node.js 18+
- Python 3.11+
- Office Add-in sideloading enabled
- Optional:
- OpenAI API key for cloud LLM mode
- Ollama for local LLM mode
cd backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
copy .env.example .envPut your OpenAI key in backend/.env:
OPENAI_API_KEY=your_api_key_here
OPENAI_MODEL=gpt-4.1-mini
LLM_PROVIDER=auto
LOCAL_LLM_ENABLED=true
LOCAL_LLM_PROVIDER=ollama
LOCAL_LLM_BASE_URL=http://localhost:11434/v1
LOCAL_LLM_MODEL=qwen3:4b
LOCAL_LLM_TIMEOUT_SECONDS=120Start the backend:
uvicorn app.main:app --reload --port 8000cd frontend
npm install
npm startThe manifest is at frontend/manifest.xml.
The frontend calls http://localhost:8000 by default. For hosted frontend builds, set VITE_BACKEND_URL to the deployed backend origin before building.
Frontend environment values can be copied from frontend/.env.example:
VITE_BACKEND_URL=http://localhost:8000- Set
OPENAI_API_KEYinbackend/.env - Set
LLM_PROVIDER=openaiorauto - Start backend and frontend
- Install Ollama
- Pull a model:
ollama pull qwen3:4bLighter option:
ollama pull llama3.2:3bStronger option:
ollama pull qwen3:8b- Ensure Ollama is running
- Confirm the local endpoint is
http://localhost:11434/v1 - Set in
backend/.env:
LLM_PROVIDER=local
LOCAL_LLM_ENABLED=true
LOCAL_LLM_PROVIDER=ollama
LOCAL_LLM_BASE_URL=http://localhost:11434/v1
LOCAL_LLM_MODEL=qwen3:4bSet:
LLM_PROVIDER=fallbackThis mode does not require an OpenAI key or Ollama.
- Start the frontend dev server
- Open Excel desktop
- Go to
Insert->My Add-ins->Upload My Add-in - Choose
frontend/manifest.xml - Open the task pane from the ribbon command
Detailed setup is in docs/LOCAL_SETUP.md.
GET /healthGET /api/llm/statusPOST /api/llm/test-localPOST /api/analyze-rangePOST /api/formula/generatePOST /api/formula/explainPOST /api/formula/fixPOST /api/action-planPOST /api/report
backend/.envis gitignored- OpenAI API key stays backend-only
- Frontend never receives or stores the API key
- Local LLM requests also go through the backend
- Original Excel sheets are never overwritten
- If the task pane shows backend disconnected, confirm
uvicornis running on port8000 - If local LLM is unavailable, confirm Ollama is running and the model is pulled
- If Excel does not load the add-in, re-sideload
frontend/manifest.xml - If a large selection is chosen, the add-in sends only sampled rows to the LLM and keeps full apply operations under the safe size limit
- Live Excel desktop interaction was not testable from this environment
- Chart creation is intentionally skipped for reliability
- Local model quality depends on hardware and model size
- Custom functions are deferred and documented in docs/CUSTOM_FUNCTIONS_PLAN.md