An AI-powered chat assistant that lives inside Excel, designed to help with Mergers & Acquisitions (M&A) work. Ask it questions about financial modeling, valuations, due diligence, or any M&A topic.
This add-in adds a chat sidebar to Excel where you can:
- Ask questions about M&A processes and get instant answers
- Get help with financial modeling and valuations
- Learn about deal structuring and due diligence
- Have conversations that understand your Excel data
Think of it as having an M&A expert sitting next to you while you work in Excel.
If you just want to get it running quickly, follow these steps:
Node.js is a tool that lets you run this project on your computer.
- Go to nodejs.org
- Download the LTS version (the one labeled "Recommended for Most Users")
- Run the installer and click "Next" through all the steps
- To verify it worked, open Command Prompt (search for "cmd" in Windows) and type:
You should see a version number like
node --versionv20.11.0
You have two options:
Option A: Download as ZIP (Easiest)
- Click the green "Code" button at the top of this page
- Click "Download ZIP"
- Extract the ZIP file to a folder like
C:\Users\YourName\Documents\excel-ai-chat
Option B: Use Git (if you have it)
- Open Command Prompt
- Navigate to where you want the project:
cd Documents - Type:
git clone <repository-url>
This project uses Google's Gemini AI (it's free for testing):
- Visit Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key (it looks like:
AIzaSyD...)
Keep this window open, you'll need this key in the next step.
- Open the project folder (
excel-ai-chat) - Find the file named
.env.example - Make a copy of it and name it
.env(just remove ".example") - Open the
.envfile with Notepad - Replace
your_google_gemini_api_key_herewith the API key you copied - Save and close the file
Dependencies are pre-built code packages that this project needs to work.
- Open Command Prompt
- Navigate to your project folder:
cd C:\Users\YourName\Documents\excel-ai-chat - Type this command and press Enter:
npm install - Wait for it to finish (this might take 2-3 minutes)
- In the same Command Prompt window, type:
npm start - Wait until you see a message like "Local: https://localhost:3000"
- Keep this window open - if you close it, the add-in stops working
- Open Microsoft Excel
- Create a new blank workbook or open an existing one
- Go to the Insert tab in the ribbon
- Click Get Add-ins (or Office Add-ins depending on your Excel version)
- Click Upload My Add-in in the top-right corner
- Click Browse and find the
manifest.xmlfile in your project folder - Click Upload
The add-in should now appear in your Excel ribbon.
- Look for the M&A AI Chat button in your Excel ribbon (usually under the "Home" tab)
- Click it to open the chat sidebar
- Start asking questions like:
- "What is a DCF valuation?"
- "How do I calculate EBITDA?"
- "What should I look for in due diligence?"
Here's what the important files in this project do:
manifest.xml- Tells Excel about your add-in (name, icon, where to find it)src/taskpane/taskpane.html- The chat interface you see in Excelsrc/taskpane/taskpane.ts- Makes the chat interface work (handles clicks, sends messages)src/api/ai-client.ts- Talks to the Google AI to get responsessrc/config/prompts.ts- Tells the AI how to behave and what it knows about M&A.env- Stores your API key (never share this file)package.json- Lists all the dependencies and commands
- Open
src/config/prompts.tsin any text editor (Notepad works fine) - You'll see a
SYSTEM_PROMPT- this is the AI's instructions - Add your own expertise areas or change how it responds
- Save the file
- In Excel, close and reopen the task pane to see changes
Example: Add this line to make it know about real estate:
- Real estate M&A and property valuation- Open
src/taskpane/taskpane.css - This file controls colors, fonts, spacing
- Change values to customize:
- Colors: look for
color:orbackground: - Text size: look for
font-size: - Spacing: look for
padding:ormargin:
- Colors: look for
Example: Make the chat bubbles blue:
.user-message {
background-color: #0078d4; /* Microsoft blue */
}This requires some programming knowledge, but here are common things you might want:
Add a Button to the Chat:
- Open
src/taskpane/taskpane.html - Add a button element:
<button id="myButton">Click Me</button> - Open
src/taskpane/taskpane.ts - Add code to handle the click
Make the AI Do Something with Excel Data:
- Open
src/taskpane/taskpane.ts - Look at the example function
getExcelData() - Use Office.js commands to read/write Excel data
- Pass that data to the AI in your message
Switch to a Different AI Provider:
- Open
src/api/ai-client.ts - The Vercel AI SDK supports OpenAI, Anthropic, and others
- Install the provider:
npm install ai @anthropic-ai/sdk(for example) - Change the import and model configuration
Open Command Prompt in your project folder and use these:
npm start- Start the development server (required for add-in to work)npm run build- Create a production-ready versionnpm install- Install dependencies (do this after downloading the project)
Problem: Clicking the ribbon button does nothing or shows an error
Solutions:
- Make sure Command Prompt is still open with
npm startrunning - Go to
https://localhost:3000in your browser and accept the security warning - Clear Excel's add-in cache:
- Close Excel completely
- Delete this folder:
%LOCALAPPDATA%\Microsoft\Office\16.0\Wef - Restart Excel and reload the add-in
Problem: When running npm start you see errors about missing modules
Solution:
- Delete the
node_modulesfolder in your project - Run
npm installagain
Problem: The AI doesn't respond or shows "API key invalid"
Solutions:
- Check that your
.envfile has no spaces around the=sign - Make sure it's named exactly
.env(not.env.txt) - Restart the development server (close Command Prompt and run
npm startagain) - Verify your API key at Google AI Studio
Problem: Can't upload the manifest.xml file
Solutions:
- Make sure you're using Excel from Microsoft 365 (not an older version)
- Try the alternative method: Use the "Shared Folder" approach in Windows:
For developers: This project uses:
- TypeScript - Adds type checking to JavaScript
- Vite - Fast development server and build tool
- Office.js - Microsoft's Excel API
- Vercel AI SDK - Simplifies AI integration
- Google Gemini - The AI model (can be swapped)
Want to learn more so you can extend this project? Start here:
- JavaScript Basics: freeCodeCamp JavaScript Course
- HTML & CSS: MDN Web Docs Tutorial
- Excel Add-ins Overview: Microsoft's Getting Started Guide
- Office.js API - How to control Excel: Reference Docs
- Google Gemini AI - The AI we're using: API Documentation
- Vercel AI SDK - Makes AI integration easier: SDK Guide
- TypeScript - JavaScript with types: TypeScript in 5 Minutes
Once you have it running, here are some ideas to make it even better:
- Change the colors and styling to match your company's brand
- Add more M&A-specific prompts (like templates for common questions)
- Create quick-action buttons for frequent tasks
- Save chat history to a file so you can review old conversations
- Add ability to export chat conversations to Word or PDF
- Create custom commands like "/analyze [range]" to analyze selected Excel cells
- Add support for uploading documents to include in the conversation
- Connect to your company's internal data sources
- Build custom Excel functions that use AI (like
=ASK("question")) - Add voice input/output capabilities
- Create automated workflows that trigger based on Excel events
Stuck? Here's where to get help:
- Check the Troubleshooting section above - Most common problems are covered
- Search the code - Use Ctrl+F in VS Code to find where things are defined
- Ask the AI - Use ChatGPT or Claude to explain specific code snippets
- Microsoft Docs - Comprehensive guides for Office add-ins
- Stack Overflow - Search for Office.js or Excel add-in questions
Quick reference for which file to edit for common tasks:
| What You Want to Do | File to Edit |
|---|---|
| Change AI personality/knowledge | src/config/prompts.ts |
| Change chat appearance | src/taskpane/taskpane.css |
| Add buttons or UI elements | src/taskpane/taskpane.html |
| Change how buttons work | src/taskpane/taskpane.ts |
| Modify AI provider settings | src/api/ai-client.ts |
| Change add-in name or icon | manifest.xml |
| Add/remove dependencies | package.json |
excel-ai-chat/
├── src/
│ ├── taskpane/
│ │ ├── taskpane.html # The chat interface HTML
│ │ ├── taskpane.css # Styling and colors
│ │ └── taskpane.ts # Makes everything work
│ ├── api/
│ │ └── ai-client.ts # Talks to Google AI
│ ├── utils/
│ │ └── storage.ts # Saves conversation history
│ └── config/
│ └── prompts.ts # AI instructions
├── assets/ # Icon images
├── manifest.xml # Excel add-in settings
├── .env # Your API key (never share!)
└── package.json # Project dependencies
This is a learning project. Feel free to use, modify, and share it.
Found a bug or have an improvement? Contributions are welcome! This is a learning project, so don't worry about making mistakes.