Using AI to translate your textual data. Get it here!
There are no end of chatbots that you can use to interact with a Large Language Model. And there are a few that have a 🪄 or ✨ button to churn out pablum, or integrated into software engineering environments. Everyone else is mostly stuck with chat interfaces. Now, my day job is on a chat interface; it is wonderful for many use cases. But it’s terrible for repeatable execution or processing data. Much of our business work is in spreadsheets – why shouldn’t we have the full and flexible power of an LLM in Excel?
I whipped up a prototype of integrating an LLM with functions in Excel. This means you can use AI on whatever data you have, to do whatever you want. It doesn’t just correct data, it can translate, find key points, write responses, or just about whatever other text job you have to do.
The project isn’t very technically complex. As a prototype and for ease of distribution, it’s in Visual Basic for Applications. It makes a call to a locally hosted LLM endpoint. It would be easy to point it to OpenAI, but I’ve found that’s overkill for this scenario. You can get it yourself at my Github repo: ExcelLLM.
It’s most interesting to consider what functions would make sense. I’ve chosen three, described from simplest to most complex.
=AICorrect
The AICorrect function uses the language model to correct typos or incorrect formats. It takes two parameters: the input data and the type of data it is. This is the simplest, and you don’t need to know anything about AI (or even very much about Excel) in order to use it.
Signature: =AICorrect(value, category)
Example: =AICorrect(A2, “email address”)
=AITemplate
The AITemplate function simplifies prompt creation by letting you use placeholders, like a printf function. You could do the same with the CONCAT feature to construct individual prompts, but I find this much simpler. This function takes a parameter for the template, and any number of parameters for the placeholder values.
Signature: =AITemplate(template,args,…)
Example: =AITemplate(“Convert the following phrase into %1 language: %2”,A3,B3)

=AIAdvanced
The AIAdvanced function lets you specify the system prompt, few-shot examples, and max tokens. Adding examples helps prevent the model from adding more information to the response that you don’t need. You must select two equal columns of prompts and completions. This is a little bit more complicated, but it’s ultimately the most powerful way to process your text.
Signature: =AIAdvanced(userPrompt,maxTokens,systemPrompt,userExamples,assistantExamples)
Example: =AIAdvanced(A7,5,”Calculate the sentiment of the given sentence from -1.0 to 1.0″,A$4:A$6,B$4:B$6)

What other functions do you think would make sense? Should this project support processing multiple cells at once, such as for data analysis? Or is it perfect as-is, and I should go talk to the Excel team? Let me know what you think!