Blog

ChatGPT for Excel vs. Building Your Own AI Spreadsheet with JavaScript

If you've used Microsoft Excel's new AI features recently, you'll know that it sends your data to OpenAI's servers for processing. In this article, we look at how to prevent that from happening so you can keep your data local.

icon jspreadsheet

Published at 30/04/2026

ChatGPT for Excel is here. So, what's next?

Back in March of 2026, Microsoft added a new ChatGPT function to its long list of features. With it, you can get answers about your spreadsheet in plain English, as well as fix messy data and automatically generate formulas. For everyday work, it's rather useful.
The problem is that every time you use it, your spreadsheet data is sent to OpenAI's servers, where it stays entirely. With sensitive work, such as anything financial or healthcare-related (basically anything involving compliance), that's a problem hard to overlook.

What ChatGPT for Excel actually does

To find this new feature, open Excel and locate the chat panel. Once there, you type things like "Summarise this data" or maybe "Find the odd numbers in Column B". You press Enter, and it sends your info to OpenAI before returning an answer.

It can also write formulas for you, spot messy data, and conduct basic-level analysis. If you happen to be less-than-confident when using Excel, that's a real bonus.

The issues rear their heads, depending on what you're working on. Each time you use it, you have no option but to send your data to OpenAI's servers. For compliance-heavy work in healthcare, finance, or government, that simply isn't an option.

Essentially, you're pretty much stuck with what Microsoft built, meaning there's no opportunity to change to a different model, use your own logic, or alter how it interprets things. Why? Because it's not designed for business users or those wanting to add their own tools on top.

Cost-wise, it can add up, too. On top of paying to use ChatGPT, you've also got to swallow the price of a Microsoft 365 subscription, for every person, each and every month. That's before we even start talking about the fact that Excel won't work in a web browser.

The alternative: a JavaScript spreadsheet with local AI

Rather than going to the trouble of bolting on AI over the top of Excel, it's better to build a web-based spreadsheet that runs AI on your own terms. To achieve this, you need three things:

  • Jspreadsheet to act as the spreadsheet UI, allowing for formulas, editable cells, dropdowns, and importing/exporting Excel
  • Ollama to run open-source language models, like Llama 3, Phi-3, or Mistral (basically whatever you want)
  • A thin API layer to connect the two

With this kind of setup, none of your data ever leaves your server. You choose the model and control the prompts. Furthermore, because it's a JavaScript component, it can fit into any web app you're building.

Setting it up

Step 1: Install Ollama and pull a model

Ollama runs language models locally on your machine. Install it, then pull a model that's good at structured data tasks.

# Install Ollama (macOS/Linux)
curl -fsSL https://ollama.com/install.sh | sh

# Pull a model (Llama 3 8B is a solid default)
ollama pull llama3

Once running, Ollama exposes a local API at http://localhost:11434. No cloud dependency, no API keys, and nothing to pay per token.

Step 2: Create the spreadsheet

Set up a basic Jspreadsheet instance. This example uses vanilla JavaScript, but it works the same way inside React, Vue, or Angular.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jspreadsheet/dist/jspreadsheet.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsuites/dist/jsuites.min.css" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/jspreadsheet/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jsuites/dist/jsuites.min.js"></script>

<div id="spreadsheet"></div>

<script>
const table = jspreadsheet(document.getElementById('spreadsheet'), {
    worksheets: [{
        minDimensions: [5, 10],
        columns: [
            { title: 'Product', type: 'text', width: 150 },
            { title: 'Region', type: 'dropdown', width: 120,
              source: ['North', 'South', 'East', 'West'] },
            { title: 'Q1 Sales', type: 'numeric', width: 100, mask: '#,##0' },
            { title: 'Q2 Sales', type: 'numeric', width: 100, mask: '#,##0' },
            { title: 'Notes', type: 'text', width: 200 },
        ],
        data: [
            ['Widget A', 'North', 45000, 52000, ''],
            ['Widget A', 'South', 38000, 41000, ''],
            ['Widget B', 'North', 67000, 63000, ''],
            ['Widget B', 'East', 29000, 35000, ''],
            ['Widget C', 'West', 51000, 48000, ''],
        ]
    }]
});
</script>

Step 3: Connect the spreadsheet to Ollama

Now, as soon as you click "Ask AI", it will grab the data from your spreadsheet, send it to Ollama with a prompt, and then show you the response. The important thing here is that everything stays on localhost and never leaves your machine.

document.getElementById('ask-ai').addEventListener('click', async () => {
    // Get the current spreadsheet data
    const worksheet = table[0];
    const data = worksheet.getData();
    const headers = worksheet.getHeaders().split(',');

    // Format the data as a readable table for the AI
    let tableText = headers.join(' | ') + '\n';
    tableText += headers.map(() => '---').join(' | ') + '\n';
    data.forEach(row => {
        tableText += row.join(' | ') + '\n';
    });

    // Send to Ollama (running locally on port 11434)
    const response = await fetch('http://localhost:11434/api/generate', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
            model: 'llama3',
            prompt: `Analyze this spreadsheet data and provide insights:\n\n${tableText}\n\nWhat patterns do you see? Any recommendations?`,
            stream: false
        })
    });

    const result = await response.json();
    document.getElementById('ai-response').textContent = result.response;
});

That's the core loop, with everything running in situ on the model you chose. You've also got the option to switch out llama3 for mistral, phi3, or any other model that Ollama is able to support.

Going further: AI-powered cell functions

A chat button will do the job, but if you go to the trouble of embedding AI directly into cell operations (so the model fires automatically when the cell value changes), you'll get a lot more out of it.

jspreadsheet(document.getElementById('spreadsheet'), {
    worksheets: [{
        minDimensions: [4, 5],
        columns: [
            { title: 'Customer Feedback', type: 'text', width: 300 },
            { title: 'Sentiment', type: 'text', width: 100 },
            { title: 'Category', type: 'text', width: 120 },
        ]
    }],
    onafterchanges: async function(worksheet, records) {
        for (const record of records) {
            // Only process changes in column A (feedback text)
            if (record.x === 0 && record.newValue) {
                const feedback = record.newValue;

                const response = await fetch('http://localhost:11434/api/generate', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({
                        model: 'llama3',
                        prompt: `Classify this customer feedback. Return only two words separated by a comma: the sentiment (positive/negative/neutral) and the category (bug/feature/praise/complaint).\n\nFeedback: "${feedback}"`,
                        stream: false
                    })
                });

                const result = await response.json();
                const [sentiment, category] = result.response.split(',').map(s => s.trim());

                // Write the AI results back into the spreadsheet
                worksheet.setValue(1, record.y, sentiment);  // Column B
                worksheet.setValue(2, record.y, category);    // Column C
            }
        }
    }
});

Type customer feedback into column A, and columns B and C fill in automatically with sentiment and category. The AI runs on your hardware, and the data stays there too.

How the two approaches compare

ChatGPT for ExcelJspreadsheet + Ollama
Data locationOpenAI serversYour server / your machine
Model choiceGPT-5.4 onlyLlama 3, Mistral, Phi-3, any Ollama model
CustomizationNoneFull control over prompts, models, and behavior
CostMicrosoft 365 + ChatGPT subscriptionFree (CE) / from $1,999/yr (Pro) + your hardware
Works in web appsNo (Excel add-in only)Yes (runs in any browser)
Offline capableNoYes (Ollama runs without internet)
Formula supportGenerates Excel formulas500+ Excel-compatible formulas (Jspreadsheet Pro)
Setup timeInstall add-in15-30 minutes for basic integration

To begin with, ChatGPT for Excel is a bit easier to set up. You just install the add-in, and you can start asking as many questions as you need. As such, if you're a business user wanting quick answers, it works.

Cards on the table: if you've got complex analysis to do, GPT-5.4 beats Llama 3 8B. For example, if you were to ask both to create a pivot table summary or explain anomalies, GPT-5.4 is going to give you the more 'polished' answer.

However, for tasks that matter most in spreadsheet work (data extraction, classification, formula suggestions, etc.), a local 8B model will do pretty well. The trade-off exists - it's just not as pronounced as most expect.

Also worth noting: if you're running local models on a laptop, its processor will typically take 2 to 5 seconds per query. Compare that to Cloud APIs that do the same in less than a second. For a chat button that's barely noticeable, but it can really add up if AI is running on every cell change across 50+ rows. That said, you can ease things a little by batching your requests or restricting your AI triggers to certain columns.

When taking the Jspreadsheet + Ollama route, it's going to take more effort at the outset, but it's worth it. That's because it gives you ownership of the whole stack, letting you pick the model and fine-tune it for your domain. You can even embed it in products you ship to customers, and the only cost you'll incur is the cost to run your own hardware.

When to use which

ChatGPT for Excel makes sense if you're a non-developer who works primarily in Excel, your data isn't sensitive, and you just need formula help without writing code. It's a good consumer product.

On the other hand, building your own makes sense if your data can't leave your infrastructure, you're putting spreadsheet functionality inside a web application, or you need to embed spreadsheet + AI in something you ship to customers. If you want to choose your own model, run it offline, or avoid per-seat licensing, this approach is for you.

If you're reading a developer blog about JavaScript spreadsheet libraries, I'd guess you're in the second group.

Getting started

If you want to try this today:

  1. Install Ollama and pull a model (ollama pull llama3)
  2. Set up Jspreadsheet CE (MIT license, free) or Jspreadsheet Pro if you need formulas and Excel import/export
  3. Connect them with the code patterns above
  4. Start simple with a "chat about my data" button, then add cell-level AI functions as you see what's useful

The examples in this post use Jspreadsheet Pro for the formula engine and cell types, but the AI integration works the same way with the free CE edition. The only difference is that CE doesn't include the formula engine or XLSX import/export.

Related