# Connect to Azure OpenAI from Excel

GPT for Excel – Autosheet can connect to [Azure AI](https://azure.microsoft.com/en-us/products/ai-foundry/tools) to use [OpenAI models](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/models-sold-directly-by-azure). In Azure AI, each model has a dedicated API endpoint that you use to access the model.

**Prerequisites**

- 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).
- You have an [Azure account](https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account) with Azure AI service access.
- You have [deployed a model](https://learn.microsoft.com/en-us/azure/foundry-classic/openai/how-to/create-resource) in a project.

To use an Azure OpenAI model:

1. [Get the Azure OpenAI API endpoint details for the model.](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-azure-openai#get-the-azure-openai-api-endpoint-details)
2. [Set up the Azure OpenAI API endpoint.](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-azure-openai#set-up-the-azure-openai-api-endpoint)
3. [Select the Azure OpenAI model.](https://autosheet.com/docs/gpt-for-excel/setup/manage-models/connect-to-azure-openai#select-the-azure-openai-model)

## Get the Azure OpenAI API endpoint details

To connect to Azure AI from GPT for Excel – Autosheet, you need the endpoint URL, API key, deployment name, and model name for the Azure OpenAI model you want to use.

1. Sign in to [Microsoft Foundry](https://ai.azure.com/).

2. Select the project that has the model you want to use.

3. Click **View deployments**.

4. In **Deployed models**, in the models list, click the name of the model you want to use.

   ![Select the deployed model](https://autosheet.com/docs/article-images/servers/azure-select-deployed-model.png)

5. Select **Details**.

6. In the model details, copy the **Target URI**, **Key**, **Deployment name**, and **Model name**.

   ![Copy the endpoint details](https://autosheet.com/docs/article-images/servers/azure-copy-endpoint-details.png)

## Set up the Azure OpenAI API endpoint

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 **Azure OpenAI endpoints (Chat Completions API)**.

   > **Tip**
   >
   > If you already have Azure OpenAI API endpoints set up, click **Add an Azure OpenAI API endpoint**.

5. Define the endpoint settings:

   - **Endpoint URL**: Enter the endpoint URL for the model using the Azure OpenAI Chat Completions API endpoint format:

     ```
     https://<resource-name>.<domain>/openai/deployments/<deployment-name>/chat/completions?api-version=<api-version>
     ```

     If the URL you copied does not use the above format, rewrite it. For example, let's assume that your deployment name is `gpt-5.4-mini`, the API version is `2025-04-01-preview`, and you copied the following URL:

     ```
     https://company-resource.services.ai.azure.com/openai/v1/responses
     ```

     To rewrite the URL into the Chat Completions API format, replace everything after the domain with `/openai/deployments/<deployment-name>/chat/completions?api-version=<api-version>` and replace the placeholders with your deployment name and the API version:

     ```
     https://company-resource.services.ai.azure.com/openai/deployments/gpt-5.4-mini/chat/completions?api-version=2025-04-01-preview
     ```

     > **Info**
     >
     > The `api-version` is the Azure OpenAI REST API version, which is not shown on the Microsoft Foundry model details page. As a rule, use `2025-04-01-preview` as the value.

   - **Model name**: Enter the model name.

   - **API key**: Enter the API key for accessing the endpoint.

   - **Display name (optional)**: Enter a custom display name for the model. If not set, the model switcher uses **Model name** as the display name.

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

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

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

You have set up the Azure OpenAI API endpoint. You can now use the endpoint model in GPT for Excel – Autosheet.

## Select the Azure OpenAI model

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. You can find the Azure OpenAI model under **Connected models**.

   ![Select a model](https://autosheet.com/docs/article-images/gpt-for-excel/model-switcher-azure.png)

5. Select the model.

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