AI meets Excel
Introduction
Imagine turning images into polished, professional descriptions; all within the familiar environment of Excel. Instead of manually uploading a handful of images into ChatGPT, this workflow is built for scale: tens, hundreds, even thousands of images can be processed in bulk with just a few clicks.
The value goes far beyond convenience. By generating image descriptions directly in Excel, you can save valuable time, ensure consistency, and keep everything organized in a tool you already know. Need product descriptions for thousands of items? Want to instantly annotate large datasets of images? Or quickly translate content into multiple languages for new markets? All of that becomes possible in a fraction of the time.
We implemented this approach for one of our customers. They are now able to generate thousands of product descriptions in three languages in a matter of minutes, rather than weeks. Everything stayed in Excel, where their team could easily review the results, saving both time and money while streamlining their entire content pipeline.
In this blog post, you’ll learn how to set it up yourself: generate image descriptions in Excel using only an image URL and OpenAI’s API. No technical expertise or complex software is required, just a few clicks and a bit of creativity. And the best part? The cost is minimal, just a few dollars can power bulk description generation at scale. Let’s dive in!
What do you need
You only need four things to get started:
1. An OpenAI account with a registered API key
2. A budget on the API
3. Excel
4. A list of image URLs
Getting Your OpenAI API Key
If you haven’t done so already, sign up or log in to OpenAI. Then, navigate to your profile and find the “User API Keys” section. Create a new secret key and make sure to save it somewhere safe, as you’ll need it later. You can also use the Azure OpenAI API, but this requires some tweaks here and there.
Budgeting for API Usage
To use the API, you’ll have to add a payment method to your OpenAI account. You can choose from various billing options. If your use-case is relatively small-scale, we recommend using the pay-as-you-go option and adding a minimal budget (e.g., $5). That amount alone will let you generate thousands of descriptions.
Getting started
Once you have your OpenAI account set up, your secret key stored securely, and a bit of money in your account, you’re ready for the fun part: generating image descriptions in Excel!
At a high level, here’s what happens in the process:
1. You provide the image through a URL in your Excel table.
2. That URL is sent via a POST request to the OpenAI API, which returns a structured response.
3. The structured response is then flattened into different columns (e.g., a short description, a detailed one, or even translations).
4. Because everything runs in Excel, refreshing or updating results is as easy as hitting “Refresh All”.
For this example, we’ll generate descriptions of famous design furniture pieces, asking the AI to provide both a straightforward, objective description and a more elaborate one.
Step 1: Create a Table in Excel
1. In Excel, set up a table (e.g., FurnitureList) that contains at least one column of image URLs (e.g., Picture).
2. Populate the table with URLs pointing to the images you want described.
Step 2: Create a Power Query Function
Open Power Query and create a new Blank Query. You’ll transform this blank query into a function that calls the OpenAI API. We will not go into detail on the API call here, but you can visit OpenAIs documentation for more details. In short, you need to select a model and a few messages, being the system content (which sets the context), the assistant content (optional, providing examples of the output required) and the user content, which contains the prompt and the image URL. You can use structured output as an additional parameter.
Below is an example of what this function could look like:
Step 3: Apply the Function to Your Table
After creating your Power Query function, create a new table query that applies the function to each row in your input table. That’s it! If you now fill in the original table with picture URLs and click ‘Refresh all’ in the data tab, the descriptions will be generated for you. You can follow the progress by clicking ‘Queries & Connections’.
Obstacles
The overall approach is simple, but getting the API input just right is the trickiest part:
1. JSON Formatting: Writing JSON for the request body can be confusing, especially because Power Query has its own syntax quirks.
2. Quotation Marks: It took some time to figure out how to structure the JSON for the API call in Power Query. For the JSON body, you need to use double double-quotes (like ""this""; see the snapshot above).
3. Line Breaks: No line breaks are allowed in any single content string, as this can lead to “Bad Request” errors if you’re not careful.
By keeping your JSON structure clean and consistent, you’ll avoid most of these pitfalls.
Results
As described above, we wanted the AI to generate both an objective and a more elaborate description for design furniture. We did not use any assistant content here, so we let the AI generate the descriptions without examples.
Objective: Nesting tables with four pieces. Rectangular tops in varying colors: blue, orange, yellow, and green. Wooden frames in light oak. Smooth surface finish.
Elaborate: Explore our vibrant nesting tables, featuring a harmonious blend of colorful tops and elegant oak frames. Perfect for modern spaces, these tables offer versatility while adding a pop of color to your decor.
Objective: Armchair and ottoman set in black leather with tufted upholstery, chrome base with curved legs, modern design, minimalist style.
Elaborate: Introducing a sleek armchair and ottoman set, elegantly crafted in black leather and supported by a graceful chrome base. This modern duo blends comfort with sophistication, perfect for enhancing any contemporary living space.
Objective: Wall-mounted shelving unit in light gray. Features multiple open shelves. Includes two drawers and a small closed cabinet. Metal brackets for support. Smooth, matte finish.
Elaborate: Discover our sleek wall-mounted shelving unit in light gray, perfect for contemporary spaces. It combines open shelving with functional drawers and cabinets, offering a stylish yet practical solution for your storage needs.
Possibilities
There are some additional possibilities you can explore when using OpenAIs API.
1. Batch API: If immediate results aren’t necessary, you can process requests asynchronously using the Batch API. This can reduce costs by up to 50% and allows for higher rate limits.
2. Additional data: Include more than just the image URL in your prompt. For instance, if you’re describing real estate images, add address, number of bedrooms, and surface area. The AI can then incorporate these details into the final description.
3. Multilingual descriptions: OpenAI offers more languages than just English, so you can create descriptions in different languages, which is useful for international businesses or global audiences.
4. Structured output: If your output needs to have a specified format, you can use this parameter to format the AI input to specific data structures, like JSON or XML. You can also use it to force your output into different categories (e.g. input a list of colors as different options to describe a furniture’s color).
Moreover, nothing limits you to basic image descriptions. You can use the functionality for other use-cases, such as extracting colors, materials or other attributes, allowing you to categorize different products. You could also ask the AI to generate accessibility-friendly alt texts to make websites more inclusive. Anything that bridges visual data with structured, text-based insights can be automated with this approach.
Wrap-up
AI-powered image description in Excel opens up a world of possibilities for teams and individuals looking to streamline their workflows. With minimal setup, you can tap into powerful language models to quickly and consistently generate high-quality descriptions; no coding or specialized software required. This approach not only saves time, but also ensures uniformity across large sets of images, making it ideal for different use-cases, from product catalogs to digital archives.
call-to-action
Ready to take your Excel workflow to the next level with AI? By following the steps in this tutorial, you can automate repetitive tasks and save valuable time that would otherwise be spent on boring, manual work. In a business context, this means faster insights, fewer errors, and more capacity to focus on what really matters.
Give the steps a try! If you run into questions or challenges, feel free to share your experiences and learnings. Don’t forget to explore OpenAI’s documentation and resources for even more possibilities, and consider how you might integrate additional data to generate rich, context-aware outputs.