Skip to main content

Set up your OpenAI API key

Set up your own OpenAI API key to benefit from cost savings and from your own rate limits, or to use your fine-tuned models and Assistants.

Prerequisites
  1. Check your permissions on the current spreadsheet, depending on its location:
    1. My Drive: You must be the Owner of the spreadsheet. You can find out who the Owner of a file is by checking the file Details.
    2. Shared Drive: You must be the Creator of the spreadsheet. You can find out who the Creator of a file is by checking the file Activity.

    If your permissions differ from these, create a Google spreadsheet or ask someone with the appropriate permissions to set up the OpenAI API key for you.

  2. Select Extensions > GPT for Sheets and Docs > Open.

  3. The sidebar appears on the right of your workbook.

  4. Select API keys from the add-on menu.

  5. Paste your secret key where indicated, then click Save.

  6. (Optional) Enter your OpenAI organization ID from the OpenAI Organization settings page, then click Save. If you are part of multiple organizations, it ensures that you get billed on the correct account.

  7. (Highly recommended) Test your OpenAI API key:
    1. Open the model switcher dropdown, and select one of the OpenAI models that use your API key.

    2. Type a simple formula in a cell and get a response from GPT:

      =GPT("Write a tagline for a car")

You have set up your OpenAI API key in GPT for Sheets and Docs.

note

When using an OpenAI API key, you need to purchase credits from OpenAI and also buy a pack in GPT for Sheets. Learn more

What's next