A Chrome extension that lets Claude review Google Docs and suggest edits like a human collaborator. The extension uses the Google Docs API to read document content, sends it to Claude for analysis, and can highlight suggestions directly in the document.
- Document Analysis: Analyzes Google Docs content for grammar, clarity, conciseness, and tone
- Inline Highlighting: Highlights suggested changes directly in the document
- Comments: Adds Google Docs comments explaining each suggestion
- Chat Interface: Discuss suggestions or ask questions about your document
- Selection Support: Select text and ask Claude about specific passages
- Multi-Tab Support: Works with Google Docs' tab feature (multiple tabs within a single document)
google-docs-claude-editor/
├── manifest.json # Chrome extension manifest (MV3)
├── background/
│ └── service-worker.js # Background service worker - orchestrates APIs
├── content/
│ └── content.js # Content script - runs on Google Docs pages
├── sidebar/
│ ├── sidebar.html # Main UI panel
│ ├── sidebar.js # Sidebar controller
│ └── sidebar.css # Styles
├── popup/
│ ├── popup.html/js/css # Extension popup (minimal)
├── options/
│ ├── options.html/js/css # Settings page for API key
├── lib/
│ ├── google-api.js # Google Docs/Drive API wrapper
│ ├── claude-api.js # Anthropic Claude API wrapper
│ ├── document-parser.js # Parses Google Docs JSON to text
│ └── chat-manager.js # Manages conversation history
└── icons/
└── icon16/48/128.png # Extension icons
-
Google Cloud Project with:
- Google Docs API enabled
- Google Drive API enabled
- OAuth 2.0 credentials (Chrome Extension type)
-
Anthropic API Key from https://console.anthropic.com/
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the following APIs:
- Google Docs API
- Google Drive API
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Select Chrome Extension as the application type
- You'll need the extension ID (get this after loading the extension in step 2, then come back)
- Copy the Client ID - you'll need it for the manifest
- Open
google-docs-claude-editor/manifest.json - Update the
oauth2.client_idwith your Google OAuth Client ID:"oauth2": { "client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com", "scopes": [ "https://www.googleapis.com/auth/documents", "https://www.googleapis.com/auth/drive.file" ] }
- Open Chrome and go to
chrome://extensions - Enable Developer mode (toggle in top right)
- Click Load unpacked
- Select the
google-docs-claude-editorfolder - Note the Extension ID shown under the extension name
- Go back to Google Cloud Console and add this ID to your OAuth credentials
- Click the extension icon or open the sidebar on any Google Doc
- You'll be prompted to enter your Anthropic API key
- Go to Settings (gear icon) and enter your API key
- The key is stored securely in Chrome's sync storage
- Open any Google Doc
- Open the extension sidebar (click the extension icon)
- Click Get Suggestions or Authorize
- Complete the Google OAuth flow to grant document access
- Open a Google Doc
- Open the extension sidebar
- Click Get Suggestions
- Wait for Claude to analyze the document
- Suggestions appear in the sidebar and are highlighted in the document
- Accept: Applies the suggested change to the document
- Reject: Removes the highlight, keeps original text
- Discuss: Opens the chat to ask questions about the suggestion
- Select text in your Google Doc
- Press Cmd+C (Mac) or Ctrl+C (Windows) to copy
- Click Get Selection in the sidebar
- Type your question about the selected text
Note: Google Docs uses canvas rendering, so standard text selection detection doesn't work. The extension reads from your clipboard instead.
The extension detects which tab you're viewing in a Google Doc (via the ?tab=t.X URL parameter) and analyzes only that tab's content. Switching tabs in the document will update the extension's context.
- Click the Authorize button to complete Google OAuth
- Make sure your OAuth client ID is correctly configured
- Check that the extension ID matches in Google Cloud Console
- Reload the extension after any code changes
- Check the browser console for errors (right-click sidebar > Inspect)
- Ensure the document hasn't been modified since getting suggestions
- Make sure to copy (Cmd+C) the text before clicking Get Selection
- Google Docs uses canvas rendering - clipboard is the only reliable method
- Verify your Anthropic API key is correct in Settings
- Check you have sufficient API credits
- Look at the service worker console for detailed errors
- Edit the source files
- Go to
chrome://extensions - Click the refresh icon on the extension
- Reload any open Google Docs tabs
lib/google-api.js: All Google Docs/Drive API calls. Methods accept optionaltabIdfor multi-tab documents.lib/document-parser.js: Converts Google Docs JSON to plain text with position mapping. Handles thetabsstructure for multi-tab documents.background/service-worker.js: Main logic for getting suggestions, applying changes.content/content.js: Runs in Google Docs pages, detects document/tab info.sidebar/sidebar.js: UI controller, handles user interactions.
- Documents with tabs use
document.tabs[].documentTab.bodyinstead ofdocument.body - Fetch with
?includeTabsContent=trueto get tab content - Range/location objects need
tabIdproperty for multi-tab documents - Position indices are per-tab, not document-wide
- Canvas Rendering: Google Docs renders text on canvas, making DOM-based selection impossible. Use clipboard instead.
- Real-time Sync: Changes made to the document while suggestions are pending may cause position mismatches.
- Rate Limits: Both Google and Anthropic APIs have rate limits. Large documents may hit these.
MIT