✨ Available on the Microsoft Marketplace: Download Here
- Install — Get the add-in from the Microsoft Marketplace (free)
- Add your API key — Click the ⚙️ icon and enter your Google Gemini API key
- Start chatting — Ask the AI to summarize, edit, or review your document!
Gemini AI for Office integrates Google Gemini AI to draft, edit, and review your document directly. Unlock the power of Google's Gemini AI directly inside Microsoft Word.
Gemini AI for Office is the ultimate writing companion, designed to help you draft, edit, and perfect your documents using your own Google API key. Whether you are a student, professional, or creative writer, this add-in streamlines your workflow while giving you full control over your AI usage and costs.
Connect your personal Google AI Studio key directly. This ensures complete privacy and allows you to pay Google directly for usage (or utilize their free tier) without the massive middleman markups.
Chat naturally with your document. Ask for summaries, clarifications, or rewrites using the latest Gemini models from Google.
The AI doesn't just suggest changes; it applies them. It rewrites sections with full Track Changes (redline) support, so you always stay in control. You can accept what you like and reject the rest.
Set up custom criteria—like "Check for Grammar" or "Verify Factual Accuracy"—and get an instant analysis every time you open a document.
Need to verify a fact? The AI can perform Google Searches to find the latest information and cite sources directly in your text.
Tailor the AI's personality and expertise. Make it a helpful tutor, a strict legal editor, or a creative writing coach.
Experiment freely with built-in state checkpoints. Easily revert to previous versions of your document if you change your mind.
Transform how you write today with Gemini AI for Office.
Simply get the add-in from the Microsoft Marketplace for an easy one-click free download.
Follow these steps if you want to modify the code or run it locally.
- Node.js (v14 or higher)
- npm or yarn
- Microsoft Word (Desktop version recommended)
- Google Gemini API key (Get one here)
-
Clone the repository
git clone <your-repo-url> cd AIWordPlugin
-
Install dependencies
npm install
-
Trust the development certificate
npx office-addin-dev-certs install
-
Start the development server
npm start
This will:
- Build the add-in
- Start a local HTTPS server on port 3000
- Open Word and sideload the add-in
-
After making code changes
- Stop the server (Ctrl+C)
- Rebuild:
npm run build:dev - Restart:
npm start - Refresh the task pane in Word (close and reopen it)
-
Manual sideloading (if needed)
- In Word, go to Insert > Add-ins > My Add-ins
- Click "Upload My Add-in"
- Select the
manifest.xmlfile from the project root
- Click the ⚙️ (gear) icon in the top right
- Enter your Google Gemini API key
- Click "Save"
- The key is stored in your browser's localStorage
- Type your question in the chat input box
- Press Enter or click "Send"
- Wait for Gemini's response
- Continue the conversation as needed
Example questions:
- "Summarize the key terms of this contract"
- "What are the termination clauses?"
- "Explain the liability section"
- (Optional) Select text in your document for context
- Enter your editing instruction in the "AI Redline Tool" section
- Click "Apply Changes as Redlines"
- The AI will analyze the document and apply changes with track changes enabled
Tips:
- Be specific in your instructions
- The AI analyzes the entire document, not just selected text
- Review all changes before accepting them
- Changes are applied with Word's Track Changes feature
Save a Checkpoint:
- Click "Save Checkpoint" to save the current document state
- Checkpoints are stored in browser localStorage
Revert to Last Checkpoint:
- Click "Revert Last" to restore the previous checkpoint
- The checkpoint is removed from the stack after reverting
Clear All Checkpoints:
- Click "Clear All" to delete all saved checkpoints
Get the most out of Gemini AI by tailoring it to your specific needs. Here are some optimized setups for different workflows:
System Message:
You are assisting an in-house lawyer at AnsonCorp. You will mainly be working on legal documents. You must be specific, precise, and double-check all your advice and suggested changes. Maintain a professional and helpful tone. Be proactive in suggesting and brainstorming.
Glance Settings:
- Summary: "Please give me a one sentence summary of this document."
- Favorability: "Does this contract favor my client or its affiliates? If neutral, leave green."
- Red Flags: "Identify any high-risk clauses or unusual terms."
System Message:
You are an academic writing tutor. Help me improve my detailed arguments and clarity without writing the essay for me. Focus on structure, thesis strength, and proper tone. Ensure I avoid passive voice where possible.
Glance Settings:
- Thesis Check: "Does the introduction clearly state a strong thesis?"
- Clarity: "Are there any overly complex sentences that should be simplified?"
- Passive Voice: "Flag any excessive use of passive voice."
System Message:
You are a creative writing coach. Assist with character development, "show, don't tell," and pacing. Do not rewrite my style, but offer suggestions to make descriptions more vivid and dialogue more natural.
Glance Settings:
- Adverb Check: "Am I overusing adverbs? Point out weak verbs relying on adverbs."
- Dialogue: "Does the dialogue sound natural and distinct for each character?"
- Pacing: "Is the pacing of this chapter consistent?"
System Message:
You are a senior executive assistant. You edit for brevity, impact, and actionability. Remove fluff and corporate jargon. Ensure the bottom line (BLUF) is clear.
Glance Settings:
- TL;DR: "Provide a one sentence executive summary."
- Action Items: "Extract all clear action items and deadlines."
- Tone: "Is the tone confident and professional?"
AIWordPlugin/
├── src/
│ ├── taskpane/
│ │ ├── taskpane.html # Main UI
│ │ ├── taskpane.js # Core functionality
│ │ ├── taskpane.css # Styling
│ └── commands/
│ ├── commands.html
│ └── commands.js
├── assets/ # Icons
├── manifest.xml # Add-in manifest
├── package.json
├── webpack.config.js
└── README.md
npm run buildnpm run lint
npm run lint:fix- Use browser DevTools (F12) in the task pane
- Check the console for error messages
- Enable verbose logging in
taskpane.jsif needed
For package-level debugging (without opening Word), use the XML harness:
npm run docx:harness -- -Action summary -InputPath "tests/Sample NDA.docx" -AsJsonYou can also list parts, grep XML, run XPath queries, and extract the package:
npm run docx:harness -- -Action list -InputPath "tests/Sample NDA.docx"
npm run docx:harness -- -Action grep -InputPath "tests/Sample NDA.docx" -Pattern "<w:numPr>"
npm run docx:harness -- -Action query -InputPath "tests/Sample NDA.docx" -Part "word/numbering.xml" -XPath "//w:num"See tests/docx-harness/README.md for full usage.
The add-in uses Google Gemini models (e.g., gemini-1.5-flash, gemini-1.5-pro). You can modify the default models in taskpane.js.
// In taskpane.js, the loadModel function determines which model to use:
function loadModel(type = 'fast') {
// ...
return type === 'slow' ? "gemini-1.5-pro" : "gemini-1.5-flash";
}
const geminiModel = loadModel(modelType);
const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/${geminiModel}:generateContent?key=${geminiApiKey}`;- API keys in localStorage - Keys are stored in browser storage (not encrypted)
- Production deployment - Use environment variables or secure key management
- HTTPS required - Office Add-ins require HTTPS in production
- Ensure the dev server is running (
npm start) - Check that port 3000 is not in use
- Verify the certificate is trusted
- Try clearing Office cache:
npx office-addin-dev-settings clear
- Verify your API key is correct
- Check your Gemini API quota
- Ensure you have internet connectivity
- Check browser console for detailed error messages
- Ensure you have edit permissions on the document
- Try manually enabling Track Changes in Word
- Check that the document isn't protected
- Check browser localStorage isn't full
- Ensure you have a valid document open
- Try clearing old checkpoints
Potential features for future versions:
- Conversation history persistence
- Export chat conversations
- Custom AI prompts/templates
- Multi-document comparison
- Advanced checkpoint management (named checkpoints, branching)
- Markdown rendering in chat
- Document analysis reports
- Integration with other AI models
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - See LICENSE file for details
For issues and questions:
- Check the Troubleshooting section
- Review Office Add-ins documentation
- Check Google Gemini API docs
- Built with Yeoman Office Add-in generator
- Powered by Google Gemini AI
- Uses Office.js API
