How to Integrate GPT-4o into Excel
Introduction
Recently, OpenAI introduced GPT-4o, and I decided to integrate it into Excel by creating my own Ask AI formula. This formula allows you to input a prompt and receive a response directly in your cell, just like a standard Excel formula. You can also concatenate it with other cells to make your formula more dynamic. This post will guide you through installing the new formula and demonstrate practical use cases.
Getting Started with the Formula
The Ask AI formula is included in my free Excel add-in, called MyToolBelt. To use it, you’ll need your own OpenAI API key. Keep in mind that using your API key may incur costs depending on your usage. Also, this formula currently only works on Windows, so Mac users will need to wait.
Creating Dynamic Prompts
The Ask AI formula functions like a standard Excel formula. You can create dynamic prompts, such as asking for the top three challenges faced by different industries. By placing the industry name in column B, you can simply drag down the formula to get results for other industries. If you update the industry name and press enter, the response updates automatically. Instead of using the “&” to concatenate text, you can use Excel’s CONCAT function.
Best Practices for Prompting
When crafting your prompts, it’s essential to specify how you want the output to look. For example, if you want just the capital of a country, instruct the AI to output only the city name. Otherwise, you might receive a longer response that includes unnecessary details. This is evident in my example where the AI provided a lengthy response that included markdown formatting, which cannot be rendered in Excel.
Saving Outputs as Text
Once you’re satisfied with the output, save it as normal text. Select the cells with your AI formulas, copy them, and paste them as values in the adjacent cells. This allows you to delete the original formula, preventing different outputs each time you run the formula, which can slow down your workbook and cost you money.
Analyzing Sales Data
For example, if you have a sales report with metadata and daily activities, you can quickly generate a management summary. Include the keyword “prompt” at the beginning of your instruction to optimize your results. Select the range you want to analyze, click a button, and the AI will provide a summary in a new worksheet.
Settings and Model Selection
The add-in includes a settings menu where you can select which AI model to use. This list updates dynamically with new OpenAI models. While there is a free version available, some features require a one-time purchase. These features include creating a table of contents with a gallery view and more.
Getting Started with the Add-in
To get started, click the link in the description to download the add-in. After submitting your name and email, you will receive the installation instructions. The installation takes just 1 to 2 minutes. Once installed, a new ribbon will appear in Excel, granting access to the Ask AI formula. The first time you use it, the settings menu will prompt you to enter your OpenAI API key.
Setting Up Your OpenAI API Key
To obtain an OpenAI API key, log in to your OpenAI account, navigate to your settings, and add balance to your account. Then, create a new API key, which you should keep confidential. Copy the key back into Excel, and you’re ready to use the Ask AI formula.
Testing the Ask AI Formula
Once the setup is complete, you can test the Ask AI formula. Be aware that using the API incurs costs, and any data inputted into the formula will be transmitted to OpenAI servers. You can opt out of seeing the disclaimer message in the future.
Final Thoughts
If you share your workbook with someone who hasn’t installed the add-in, they’ll see a name error instead of the formula result. The latest version of the add-in includes the new formula, so make sure to check for updates regularly.
Conclusion
Integrating GPT-4o into Excel through the Ask AI formula can significantly enhance your productivity by allowing you to generate dynamic responses directly within your spreadsheets. With the right prompts and practices, the possibilities are endless. Enjoy experimenting with the formula, and happy Exceling!