A few months ago, a client came to us with a straightforward frustration: their team was spending hours every week copy-pasting data between Excel spreadsheets and writing repetitive summaries in Word documents. They wanted something smarter. They wanted AI. And honestly, so did I — so I took on the challenge of building AI-powered features directly into the tools they already used every day.
What followed was one of the most practical and surprisingly accessible projects I've worked on. Here's exactly how I did it, what I used, and what I'd do differently if I started over.
Why Build Inside Word and Excel at All?
The obvious question is: why not just use a standalone AI tool? The answer is adoption. People don't want another tab to open or another login to remember. If you can bring intelligence directly into the environment where work already happens, you remove the friction entirely. For most business teams, that environment is Microsoft Office.
Microsoft's Office platform supports customization through Office Add-ins, which run inside Word and Excel using web technologies — HTML, CSS, and JavaScript. Combined with the OpenAI API (or Azure OpenAI Service for enterprise compliance), you have everything you need to build genuinely useful AI features without asking anyone to change their workflow.
The Tech Stack I Used
Before diving into the build, here's what I worked with:
- Office Add-in framework — Microsoft's official platform for extending Word and Excel
- React + TypeScript — for building the task pane UI
- OpenAI API (GPT-4o) — the language model powering the features
- Office.js — the JavaScript library that lets your code read from and write to documents
- Node.js backend — to handle API calls securely without exposing keys client-side
You don't need all of this to get started. A basic proof of concept can run entirely in vanilla JavaScript. But for anything production-ready, this stack held up well.
Step 1 — Scaffolding the Office Add-in
Microsoft provides a Yeoman generator that scaffolds an add-in project in minutes. I ran yo office from the terminal, chose the React TypeScript template, and selected both Word and Excel as target hosts. Within five minutes I had a working development environment with hot reload.
The generator creates a manifest file — an XML document that tells Office what your add-in is, where it lives, and what permissions it needs. Getting comfortable with the manifest early saves a lot of debugging time later. Permissions in particular are easy to overlook: you need to declare ReadWriteDocument access if you want your add-in to write content back into the file, not just read it.
Step 2 — Connecting to the AI
I set up a simple Node.js/Express endpoint that accepted a prompt from the front end and returned a completion from OpenAI. Keeping API keys server-side is non-negotiable — never put them in the add-in code itself.
For the Excel use case, I built a feature that read a selected range of cells, formatted the data as structured text, and sent it to GPT-4o with a prompt asking for a plain-English summary of trends. The response came back and was injected directly into a designated cell or a sidebar panel.
For Word, I built a writing assistant that could take selected text and rewrite it in a specified tone — formal, concise, persuasive — based on a dropdown the user selected in the task pane. The rewritten text replaced the selection automatically using Office.js's context.document.getSelection().insertText() method.
Step 3 — The Excel Feature in Detail
The Excel AI summarizer ended up being the client's favourite feature. Here's the core logic flow:
- User selects a range of cells containing sales or operational data
- Add-in reads the range values using context.workbook.getSelectedRange().load('values')
- The values array is serialized into a readable table format and appended to a prompt
- GPT-4o returns a natural language summary with highlights and anomalies
- The summary is written into a pre-labelled output cell or displayed in the task pane
We also built a secondary mode where users could ask freeform questions about their data — essentially a basic chat interface anchored to whatever range they had selected. This became surprisingly powerful for non-technical stakeholders who wouldn't ordinarily write Excel formulas.
Step 4 — The Word Feature in Detail
The Word assistant had a different challenge: working with unstructured prose rather than structured data. I used a task pane with three controls:
- A tone selector (formal, casual, persuasive, technical)
- A length modifier (shorten, expand, keep the same)
- A freeform instruction box for custom prompts
When the user clicked the rewrite button, the add-in grabbed the selected text, built a prompt combining the tone and length instructions, called the API, and swapped in the result. I added a Revert button that stored the original selection in local state so users could undo the AI edit without hitting Ctrl+Z repeatedly.
One thing that made a real difference: I prefixed every prompt with context about the document type. If the document was a proposal, the rewrite felt different from a policy document. I let users tag the document type at the start of a session, and that single addition improved output quality noticeably.
What I'd Do Differently
A few honest lessons from the build:
- Start with one host, not two. Building for Word and Excel simultaneously added complexity early. I'd nail one first and port the patterns across.
- Cache aggressively. API latency inside an Office task pane feels slower than in a web app. Caching common prompts and responses made the experience feel much snappier.
- Test on real Office versions. Office.js behaviour differs between Office 365 online, the desktop app, and older perpetual licenses. I hit a frustrating bug on Office 2019 that didn't appear anywhere in the web version.
- Design the task pane for small screens. The task pane is narrow by default. Keep UI elements stacked and minimal — users hate horizontal scrolling inside a sidebar.
The Results
The client's team went from spending roughly four hours per week on manual summarization and document editing to under forty minutes. The add-in handled the repetitive cognitive work; the humans handled the judgment calls. That's the right division of labour.
More importantly, adoption was immediate because there was nothing new to learn. The tools looked familiar. The AI was just there, inside the software they already opened every morning.
If you're sitting on a business process that lives inside Office documents, this approach is worth serious consideration. The barrier to entry is lower than most people expect, and the productivity gains are very real.


