- A Google account
- An OpenAI account
- Go to the Google Cloud Console.
- Select your project or create a new one.
- Click on the hamburger menu and select "APIs & Services"
- Click on "Enable APIs and Services"
- Search for "Google Sheets API" and enable it.
- Go to the OpenAI website and create an account.
- After you've logged in, go to the API section and create a new API key.
- Copy and past that API key in the script on line 39 called "Authorization"
- In the Script Editor, click on the "Run" menu and select the "onOpen" function.
- In the Google Sheet, refresh the sheet and you will see the new menu "Formula Generation"
- Select the cell you want to generate formula for, click on "Formula Generation" and select "generate formula"
- You will need to give the script permission to run! Follow onscreen instructions!
Note:
- The script will only work if the API key is added to line 39 called "Authorizations".
- The script is using the
davinci-codex
engine. - You can change the
prompt
in the script to adjust the instruction to generate the formula.