Flo Goertzen
  • Visit DailyDesign
🤖

How to set up ChatGPT for Google Sheets (Feb 2023)

⌛
Note that his article was last updated in February 2023 and some information might not be accurate anymore.

Table of contents:

  • Goal: Use the power of GPT directly within Google Sheets
  • Step 1: Create OpenAI account
  • Step 2: Configure OpenAI account
  • Step 3: Create your API key
  • Step 4: Download GPT for Sheets
  • Step 5: Activate API key
  • Done

Goal: Use the power of GPT directly within Google Sheets

To do so, I’ll be using the Google Sheets extension GPT for Sheets™ and Docs™. Which will let you do cool things like this:

Using GPT in Google Sheets
Using GPT in Google Sheets

The add-on can help tremendously with tasks like:

  • extracting enhanced data
  • cleaning up and validating data
  • generating text templates
  • summarizing text
  • classifying data with sentiment analysis

and much more.

It enables you to use GPT-3’s power by connecting to the OpenAI API, and using a couple of simple functions:

List of GPT functions (as of 9 Feb 2023)
List of GPT functions (as of 9 Feb 2023)

Here’s how I set up GPT for Google Sheets from scratch.

Step 1: Create OpenAI account

If you don’t already have an account, head over to openai.com/api/ and create one.

💡
Little trick to create multiple OpenAI accounts: When creating an OpenAI account, you need to verify it using a phone number. If you try to register a 2nd account with the same number, you get an error: “This phone number is already linked to the maximum number of accounts.” But even if you don’t have access to multiple phone numbers, there’s still a way to at least open a 2nd account with the same number. Simply add an extra 0 in front of your number. Example: If the number you entered for your first account was 1740123456, this time, just change it to 01740123456. That’s how it worked for me, at least. However, OpenAI still knows it’s you, and won’t give you any additional free API credits.

Step 2: Configure OpenAI account

Once you’ve successfully registered and logged in, you should be looking at some page of the OpenAI platform.

Now, click on your account image in the upper-right corner and navigate to “Manage account” → “Billing”.

The Google Sheets add-on works by connecting with OpenAI’s API. It does that, by using your personal API key (see Step 3). Unfortunately, using your key to make API calls (= using ChatGPT in Google Sheets) is currently not free of cost. That’s why you will need to change your OpenAI account from a “free trial” to a “paid account”.

💰
With OpenAI’s pricing, you only pay what you use. The more words you give to and receive from the AI, the more you’ll be charged. Their current pricing is really fair though: ~750 words cost between $0.0004 and $0.02 (as of Feb. 2023)

So, in the “Billing Overview”

  • click on “Set up paid account”
  • and set up your payment method.

That’s it. You’re now on a “paid account” and can use the API.

If you’re anxious about spending too much money on the GPT x Google Sheets magic, you can head over to “Usage limits” and set up a spending limit. Once that is reached, further requests will be denied. By default, the hard limit is set to $120.

Step 3: Create your API key

  • Head over to API Keys
  • Click on “Create new secret key”
  • In the pop-up, copy your freshly generated API key
  • It should look something like this.
    It should look something like this.

Step 4: Download GPT for Sheets

  • Head over to page of GPT for Sheets™ and Docs™ in the Google Workspace Marketplace
  • Click “Install”
  • Give permission for the add-on with the Google account you want to install it for
  • Go through the steps shown to you

Step 5: Activate API key

Once the add-on is installed, you need to set up your API key within the add-on’s settings.

  • Open Google Sheets
  • Click on “Extensions” → “GPT for Sheets™ and Docs™” → “Set API key”
  • image
  • Paste in the API key you copied earlier and click “Save API key”
  • image
  • You should now be able to use the GPT formulas. Try it by typing =GPT("Hello world") in a cell.
  • ⚠️
    If you get an error like this, it might be due to using multiple Google accounts in the same Chrome session.
    image

    The easiest way to work around this, is to simply open a new Chrome Incognito tab (Cmd ⌘ + Shift + N (Mac) / Ctrl + Shift + N (Windows)) and set up the API key there. By default, you won’t be logged into any accounts in Incognito mode, so just log in to the Google account you installed the add-on for, and go to Google Sheets again to set up your API key. For more troubleshooting, see the add-on’s creators’ Errors overview.

Done

For more use cases of this add-on, check out the creators’ website.

Also, feel free to let me know of any cool ways you’re using this!

← All blog posts

Resources:

https://gptforwork.com/set-up/how-to-create-openai-api-key

https://gptforwork.com/set-up/how-to-set-up-api-key

LinkedIn