Skip to content

martinkimoe/excel-ai-chat

Repository files navigation

Excel M&A AI Chat Assistant

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.

What Does This Do?

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.

Quick Start for Windows Users

If you just want to get it running quickly, follow these steps:

Step 1: Install Node.js

Node.js is a tool that lets you run this project on your computer.

  1. Go to nodejs.org
  2. Download the LTS version (the one labeled "Recommended for Most Users")
  3. Run the installer and click "Next" through all the steps
  4. To verify it worked, open Command Prompt (search for "cmd" in Windows) and type:
    node --version
    
    You should see a version number like v20.11.0

Step 2: Get the Project Files

You have two options:

Option A: Download as ZIP (Easiest)

  1. Click the green "Code" button at the top of this page
  2. Click "Download ZIP"
  3. Extract the ZIP file to a folder like C:\Users\YourName\Documents\excel-ai-chat

Option B: Use Git (if you have it)

  1. Open Command Prompt
  2. Navigate to where you want the project: cd Documents
  3. Type: git clone <repository-url>

Step 3: Get a Free AI API Key

This project uses Google's Gemini AI (it's free for testing):

  1. Visit Google AI Studio
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Copy the key (it looks like: AIzaSyD...)

Keep this window open, you'll need this key in the next step.

Step 4: Configure the Project

  1. Open the project folder (excel-ai-chat)
  2. Find the file named .env.example
  3. Make a copy of it and name it .env (just remove ".example")
  4. Open the .env file with Notepad
  5. Replace your_google_gemini_api_key_here with the API key you copied
  6. Save and close the file

Step 5: Install Project Dependencies

Dependencies are pre-built code packages that this project needs to work.

  1. Open Command Prompt
  2. Navigate to your project folder:
    cd C:\Users\YourName\Documents\excel-ai-chat
    
  3. Type this command and press Enter:
    npm install
    
  4. Wait for it to finish (this might take 2-3 minutes)

Step 6: Start the Add-in

  1. In the same Command Prompt window, type:
    npm start
    
  2. Wait until you see a message like "Local: https://localhost:3000"
  3. Keep this window open - if you close it, the add-in stops working

Step 7: Load the Add-in into Excel

  1. Open Microsoft Excel
  2. Create a new blank workbook or open an existing one
  3. Go to the Insert tab in the ribbon
  4. Click Get Add-ins (or Office Add-ins depending on your Excel version)
  5. Click Upload My Add-in in the top-right corner
  6. Click Browse and find the manifest.xml file in your project folder
  7. Click Upload

The add-in should now appear in your Excel ribbon.

Step 8: Start Using It

  1. Look for the M&A AI Chat button in your Excel ribbon (usually under the "Home" tab)
  2. Click it to open the chat sidebar
  3. Start asking questions like:
    • "What is a DCF valuation?"
    • "How do I calculate EBITDA?"
    • "What should I look for in due diligence?"

What Each File Does (Plain English)

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 Excel
  • src/taskpane/taskpane.ts - Makes the chat interface work (handles clicks, sends messages)
  • src/api/ai-client.ts - Talks to the Google AI to get responses
  • src/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

How to Customize and Extend

Change What the AI Knows About

  1. Open src/config/prompts.ts in any text editor (Notepad works fine)
  2. You'll see a SYSTEM_PROMPT - this is the AI's instructions
  3. Add your own expertise areas or change how it responds
  4. Save the file
  5. 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

Change How the Chat Looks

  1. Open src/taskpane/taskpane.css
  2. This file controls colors, fonts, spacing
  3. Change values to customize:
    • Colors: look for color: or background:
    • Text size: look for font-size:
    • Spacing: look for padding: or margin:

Example: Make the chat bubbles blue:

.user-message {
  background-color: #0078d4; /* Microsoft blue */
}

Add New Features

This requires some programming knowledge, but here are common things you might want:

Add a Button to the Chat:

  1. Open src/taskpane/taskpane.html
  2. Add a button element: <button id="myButton">Click Me</button>
  3. Open src/taskpane/taskpane.ts
  4. Add code to handle the click

Make the AI Do Something with Excel Data:

  1. Open src/taskpane/taskpane.ts
  2. Look at the example function getExcelData()
  3. Use Office.js commands to read/write Excel data
  4. Pass that data to the AI in your message

Switch to a Different AI Provider:

  1. Open src/api/ai-client.ts
  2. The Vercel AI SDK supports OpenAI, Anthropic, and others
  3. Install the provider: npm install ai @anthropic-ai/sdk (for example)
  4. Change the import and model configuration

Useful Commands

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 version
  • npm install - Install dependencies (do this after downloading the project)

Troubleshooting

The Add-in Won't Load

Problem: Clicking the ribbon button does nothing or shows an error

Solutions:

  1. Make sure Command Prompt is still open with npm start running
  2. Go to https://localhost:3000 in your browser and accept the security warning
  3. 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

"Cannot Find Module" Error

Problem: When running npm start you see errors about missing modules

Solution:

  1. Delete the node_modules folder in your project
  2. Run npm install again

API Key Not Working

Problem: The AI doesn't respond or shows "API key invalid"

Solutions:

  1. Check that your .env file has no spaces around the = sign
  2. Make sure it's named exactly .env (not .env.txt)
  3. Restart the development server (close Command Prompt and run npm start again)
  4. Verify your API key at Google AI Studio

Excel Says "Upload Failed"

Problem: Can't upload the manifest.xml file

Solutions:

  1. Make sure you're using Excel from Microsoft 365 (not an older version)
  2. Try the alternative method: Use the "Shared Folder" approach in Windows:

Technical Details

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)

Learning Resources

Want to learn more so you can extend this project? Start here:

For Beginners

For This Project Specifically

Next Steps and Ideas

Once you have it running, here are some ideas to make it even better:

Easy Improvements

  • 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

Medium Difficulty

  • 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

Advanced Features

  • 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

Getting Help

Stuck? Here's where to get help:

  1. Check the Troubleshooting section above - Most common problems are covered
  2. Search the code - Use Ctrl+F in VS Code to find where things are defined
  3. Ask the AI - Use ChatGPT or Claude to explain specific code snippets
  4. Microsoft Docs - Comprehensive guides for Office add-ins
  5. Stack Overflow - Search for Office.js or Excel add-in questions

Important Files Reference

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

Project Structure

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

License

This is a learning project. Feel free to use, modify, and share it.

Contributing

Found a bug or have an improvement? Contributions are welcome! This is a learning project, so don't worry about making mistakes.

About

Excel AI Chat Plugin for M&A Work

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors