- Open your google sheet
- Navigate to Extensions > Apps Script
- Paste in the script located in the file
script.js
- Generate or fetch api key from your open-ai account (https://beta.openai.com/account/api-keys)
- Replace
<OPENAI_API_KEY>
with your open-ai api key.
To use this simple GPT3 app script just call the following function in your spreadsheet. The function concatenates the inputs to create a prompt which is sent to GPT3.
GPT3(arg1, arg2, ...)
For this example we can assume cell C4=2
and cell D4=4
in the spreadsheet.
Spreadsheet function call
=GPT3("add", C4, "and", D4, "together")
The prompt sent to GPT-3 would be
"add 2 and 4 together"
Output
2 + 4 = 6