Run Local LLMs in Excel with XLlama
Job to be done: Run local LLMs directly within Excel for data extraction and analysis
🇳🇬 Ways to use this in Nigeria
Ideas to get you started, adapt to your situation.
- Small business
Extract customer names and order details from WhatsApp chat logs saved in Excel for faster follow-up.
- Student
Summarize lecture notes in Excel cells to create quick study guides without internet.
- 9-5 employee
Categorize and tag thousands of customer feedback entries in an Excel sheet offline.
What you’ll get
You will be able to run Large Language Models (LLMs) directly within Microsoft Excel using the XLlama add-in. This allows for local data extraction and analysis without needing internet access or paying for API calls. This approach is ideal for quick, repetitive tasks on sensitive data or when internet connectivity is unreliable.
Tools you need
- XLlama (free): An Excel add-in that connects to local LLMs.
- Ollama (free): Software to download and run LLMs like Llama3 on your computer.
- Microsoft Excel (paid): Spreadsheet software for data manipulation and analysis.
- Llama3 (free): A powerful open-source LLM that can be run locally via Ollama.
Steps
- Install Ollama: Download and install Ollama from the official website. Follow the on-screen instructions for your operating system. You should see a confirmation message indicating Ollama is running.
- Download Llama3: Open your terminal or command prompt and run the command to download the Llama3 model. This may take some time depending on your internet speed.
You should see progress indicators and a message confirming the download is complete.ollama pull llama3 - Install XLlama: Download the XLlama add-in from the provided link. Follow the installation instructions, which typically involve enabling add-ins within Excel. The XLlama add-in should appear in your Excel ribbon or formulas list.
- Test a simple prompt: In an Excel sheet, select a cell and type the following formula, replacing the text with your query. This uses XLlama to send a prompt to your local Llama3 model.
The cell should populate with the answer generated by Llama3 running locally.=XLlamaPrompt("Is Excel a database?") - Run on a range of data: If you have text in a range of cells (e.g., A1:A10), you can apply a prompt to each cell. For example, to extract names from a list of text entries, you might use a prompt like this in cell B1, assuming your text is in A1:
Drag the fill handle (a small square at the bottom right of cell B1) down to apply this formula to the rest of the cells in column A. Each cell in column B should then show the extracted name.=XLlamaPrompt("Extract the name from this text: " & A1)
Original source
This workflow is based on a “Show HN” post on Hacker News by user SvenBosau. The author developed an Excel add-in called XLlama that integrates with Ollama, enabling users to run local LLMs like Llama3 directly within Excel for data tasks.
Notes & variations
- Free Tier Alternative: This workflow is entirely free if you have Microsoft Excel already, as both Ollama and Llama3 are free to use. If you do not have Excel, consider free spreadsheet alternatives like Google Sheets, though integration might require different add-ins or scripting.
- Common Pitfall: Ensure Ollama is running in the background before you try to use the XLlama add-in. If XLlama returns an error, check that Ollama is active on your system.
- Tip for Better Results: For more complex data extraction or analysis, experiment with more detailed prompts. Specify the exact format you want the output in (e.g., “Extract the name and email address in JSON format: ”).