A simple script to use OpenAI's GPT models in Google Sheets. This allows you to do things like summarisation, translation, entity extraction, classification, etc.
- Open the Google Sheet where you want to use ChatGPT.
- Go to
Extensions
>Apps Script
. - Copy the contents of
Code.gs
and paste it into the script editor. - Copy the contents of
settings.html
and paste it into a new HTML file with the same name. - Save both and reload the Google Sheet.
- You should now see a new menu item called
LLM
. Click on it and thenSettings
. - Enter your OpenAI API key and save.
You now have access to a new =LLM()
function in Google Sheets. You can use it like this:
=LLM(<input_text>, "Summarise the text", "gpt-4o-mini", 0)
By default, the function uses the gpt-4o-mini
model with a temperature of 0
, but you can change it to gpt-4
for more advanced tasks or increase the temperature for more creative responses.
- Add support for non-OpenAI models