Skip to main content

Connect to Ollama from Excel

GPT for Excel can connect to an Ollama server to use locally running open-source models. Ollama is an open-source platform that allows you to easily install, run, and serve models from a local machine, keeping your prompting entirely offline. You can use any model from the Ollama library.

You can use Ollama models as Agent models and as bulk models. The server requirements are different for each type of model:

  • Agent models: The server must run Ollama v0.13.3 or later, which supports OpenAI's Responses API, and must be publicly accessible over the internet through HTTPS, because the Agent calls the server through GPT for Work servers. The model must support a context length of at least 32K tokens.

  • Bulk models: Any Ollama server, including a local server that is not accessible over the internet.

Prerequisites
info

Depending on the model you use, the model settings defined in GPT for Excel (temperature (creativity), top-p, frequency penalty, and presence penalty) may not work as expected. If you get bad results, try tweaking the settings.

To use models from an Ollama server:

  1. Set up the API endpoint for the Ollama server.

  2. Select a model available on the Ollama server.

Set up the API endpoint for an Ollama server​

  1. Sign in to the GPT for Work dashboard with your Microsoft account.

  2. In the sidebar, select Custom API endpoints.

  3. Select the Agent models tab.

  4. Click OpenAI-compatible endpoints (Responses API).

    tip

    If you already have OpenAI-compatible API endpoints set up, click Add an OpenAI-compatible API endpoint.

  5. Define the endpoint settings:

    • Endpoint URL: Enter the public URL of the Ollama server. The server must be publicly accessible over the internet, for example through a reverse proxy or a tunneling service. Setting this up depends on your infrastructure and is not covered by this documentation.

    • Model ID: Enter the ID of the model to use, as listed by the ollama list command. The model ID is sent to the endpoint in the request payload.

    • Display name (optional): Enter a short name that identifies the model in the Agent model switcher.

    • API key (optional): Leave this field empty. The Ollama server does not require an API key for access.

    Define Ollama server API endpoint settings
  6. Click Check to validate the settings and click Save.

You have set up the Ollama server API endpoint. The model is now available in the Agent model switcher and in the Agent models page of the GPT for Work dashboard.

Select a model from the Ollama server​

  1. Open a Microsoft Excel workbook.

  2. On the ribbon, select Home > GPT for Excel Word.

    GPT for Excel Word on the Home ribbon
    info

    If GPT for Excel Word is not visible on the ribbon, or if it's grayed out, select Home > Add-ins > My Add-ins > GPT for Excel Word. Learn more.

  3. In the sidebar, select Agent.

  4. Open the model switcher and select the model.

    Select a model

The Agent now uses the Ollama model as the Agent model.

info

Some Agent tools, such as web search, are not available when the Agent uses an endpoint-connected model.

What's next​