# Connect to Ollama from Excel

> **Info**
>
> This feature is only available if your space is on the [Business or Enterprise plan](https://autosheet.com/docs/resources/pricing/subscription) or [pay-as-you-go pricing](https://autosheet.com/docs/resources/pricing/pay-as-you-go).

GPT for Excel – Autosheet can connect to an [Ollama server](https://ollama.com/) to use [locally running open-source models](https://autosheet.com/docs/resources/guides/concepts#local-model). 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](https://ollama.com/library).

You can use Ollama models both as [Agent models](https://autosheet.com/docs/resources/guides/concepts#agent-model) and [bulk models](https://autosheet.com/docs/resources/guides/concepts#bulk-model), but the server requirements are different:

- **Agent models**: The server must support the [OpenAI Responses API](https://developers.openai.com/api/reference/responses/overview) (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 Autosheet (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.](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama#set-up-the-api-endpoint-for-an-ollama-server)
2. [Select a model available on the Ollama server.](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama#select-a-model-from-the-ollama-server)

## Set up the API endpoint for an Ollama server

**Agent models**

**Prerequisites**

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

  - [Set up Ollama on macOS](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-macos)
  - [Set up Ollama on Windows](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-windows)

- 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 [Autosheet dashboard](https://dashboard.autosheet.com/) with your [Microsoft or Google account](https://autosheet.com/docs/gpt-for-excel/setup/sign-in).

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](https://autosheet.com/docs/article-images/dashboard/api-endpoints-settings-ollama-agent.png)

6. Click **Check** to validate the settings and click **Save**.

   ![Save Ollama server API endpoint settings](https://autosheet.com/docs/article-images/dashboard/api-endpoints-settings-openai-save.png)

You have set up the Ollama server API endpoint. The model is now available in the [Agent model switcher](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama#select-a-model-from-the-ollama-server) and on the [models page](https://autosheet.com/docs/admin/ai-configuration/manage-models) of the Autosheet dashboard.

**Bulk models**

**Prerequisites**

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

  - [Set up Ollama on macOS](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-macos)
  - [Set up Ollama on Windows](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-windows)

1. Sign in to the [Autosheet dashboard](https://dashboard.autosheet.com/) with your [Microsoft or Google account](https://autosheet.com/docs/gpt-for-excel/setup/sign-in).

2. In the sidebar, select **Custom API endpoints**.

3. Select the **Bulk models** tab.

4. Click **OpenAI-compatible endpoints (Chat Completions 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 URL of the Ollama server.
   - **Display name (optional)**: Enter a short name that is prefixed to the model names in the model switcher. By default, the model names are prefixed with "custom/".
   - **API key (optional)**: Leave this field empty. The Ollama server does not require an API key for access.

   ![Define Ollama server API endpoint settings](https://autosheet.com/docs/article-images/dashboard/api-endpoints-settings-ollama-bulk.png)

6. Click **Check** to validate the settings and click **Save**.

   ![Save Ollama server API endpoint settings](https://autosheet.com/docs/article-images/dashboard/api-endpoints-settings-openai-save.png)

   > **Tip**
   >
   > If you get an error saying that the URL is invalid, make sure that the Ollama server supports:
   >
   > - **Cross-origin resource sharing (CORS).** See the Ollama server setup instructions for [macOS](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-macos#enable-cors-for-the-ollama-server) or [Windows](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-windows#enable-cors-for-the-ollama-server).
   > - **HTTPS (needed with Safari and with Microsoft Office for Mac).** See the Ollama server setup instructions for [macOS](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-macos#enable-https-for-the-ollama-server).

You have set up the Ollama server API endpoint. You can now use all models available through the endpoint in GPT for Excel – Autosheet.

## Select a model from the Ollama server

**Agent models**

1. Open a Microsoft Excel workbook.

2. On the [ribbon](https://support.microsoft.com/en-US/Office/foundations-experiences/show-or-hide-the-ribbon-in-office), select **Home > GPT for Excel Word – Autosheet**.

   ![GPT for Excel Word – Autosheet on the Home ribbon](https://autosheet.com/docs/article-images/gpt-for-excel/launch.png)

   > **Info**
   >
   > If **GPT for Excel Word – Autosheet** is not visible on the ribbon, or if it's grayed out, select **Home > Add-ins > My Add-ins > GPT for Excel Word – Autosheet**. [Learn more.](https://autosheet.com/docs/gpt-for-excel/troubleshooting/add-in-not-working#add-in-button-is-grayed-out)

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](https://autosheet.com/docs/article-images/gpt-for-excel/model-switcher-ollama-agent.png)

GPT for Excel – Autosheet 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.

**Bulk models**

1. Open a Microsoft Excel workbook.

2. On the [ribbon](https://support.microsoft.com/en-US/Office/foundations-experiences/show-or-hide-the-ribbon-in-office), select **Home > GPT for Excel Word – Autosheet**.

   ![GPT for Excel Word – Autosheet on the Home ribbon](https://autosheet.com/docs/article-images/gpt-for-excel/launch.png)

   > **Info**
   >
   > If **GPT for Excel Word – Autosheet** is not visible on the ribbon, or if it's grayed out, select **Home > Add-ins > My Add-ins > GPT for Excel Word – Autosheet**. [Learn more.](https://autosheet.com/docs/gpt-for-excel/troubleshooting/add-in-not-working#add-in-button-is-grayed-out)

3. In the sidebar, select **Bulk tools** and select one of the tools.

   ![Bulk tools in the sidebar](https://autosheet.com/docs/article-images/gpt-for-excel/bulk-tools-in-sidebar.png)

4. Open the model switcher and select a model. You can find the Ollama models under **Connected models**, at the end of the list.

   ![Select an Ollama model for bulk work](https://autosheet.com/docs/article-images/gpt-for-excel/model-switcher-ollama-bulk.png)

   > **Info**
   >
   > The available models depend on the models available on the Ollama server.

Autosheet now uses the selected model to generate responses for bulk tools and GPT functions.

## What's next

- Set up an Ollama server on [macOS](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-macos) or [Windows](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-ollama/set-up-ollama-on-windows).
