Skip to main content

Connect to Ollama from Excel

info

This feature is only available if your space is on the Business or Enterprise plan or pay-as-you-go pricing.

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. You can use any model from the Ollama library.

You can use Ollama models both as Agent models and bulk models, but the server requirements are different:

  • Agent models: The server must support the OpenAI Responses API (Ollama 0.13.3 or newer) and be publicly accessible over the internet through HTTPS. In addition, the model must support a context size of at least 32K tokens.

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

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​

Prerequisites
  • You have an Ollama server running with one or more models. For instructions on how to set up the server, see:

  • The server supports the following OpenAI-compatible API resource path: /v1/responses

  • The server is publicly accessible over the internet through HTTPS.

  • The model supports a context size of at least 32K tokens.

  1. Sign in to the GPT for Work dashboard with your Microsoft or Google 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.

    Save Ollama server API endpoint settings

You have set up the Ollama server API endpoint. The model is now available in the Agent model switcher and on the 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 a model. You can find the Ollama models at the end of the list.

    Select an Ollama model for the Agent

GPT for Excel now uses the selected 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​