Skip to main content

Set up your Gemini AI key

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

Prerequisites
Note

Only the owner of the spreadsheet can set the API key. If you are not an owner than you can not set the API key.

  1. Check your permissions on the current spreadsheet, depending on its location:

    • 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.
    • 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 > Gemini for Sheets™ and Docs™ > Set API key.

    The sidebar appears on the right of your Google spreadsheet.

  3. Paste your Gemini API key where indicated, and click Save.

  4. (Highly recommended) Test your Gemini API key:

    1. Open the model switcher dropdown, and select one of the Gemini models.

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

      =GEMINI("Write a tagline for a cafe")

You have set up your Gemini API key in Gemini for Sheets™ and Docs™. Any user with Editor's access to this spreadsheet can now execute GEMINI functions using this API key.