ChatGPT 3.5 Excel script

Everybody seems to want to use AI to create Excel formulas, so here is a way of building an interface to the OpenAI ChatGPT 3.5 model. Leila Gharani has already published a video and the Office Script code to call the GPT-3 API. This is for ChatGPT 3.5 which has a different data structure in the JSON.

I did this as an exercise in learning Excel scripting, which is based on Typescript, with some limitations both on the language features and the amount of access it has to the Excel Object Model.

You can download the ChatGPT in Excel demo workbook here. It has two sheets, The API sheet is where you fill in the API key you get when you sign up on openai.com, and it contains the script as plain text. The ChatGPT sheet is where you put in the prompts and then run the script to get the answer.

Enjoy it! Let me know how you get on.

Advertisement

About Patrick O'Beirne, Excel/VBA developer

Patrick provides consultancy and training in spreadsheet automation, data analysis, testing and model review; and the Excel spreadsheet auditing addin XLtest
This entry was posted in Excel/VBA and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s