Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Read this skill when you need to read or write Google Docs. Reading works without opening a browser tab.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | 12% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -14% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -5% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -6% | 0% |
| case-11 | ✗→✓ | ▲ Improved | -6% | 0% |
Use the googleDocs global in the REPL tool. Cookie-only reads work without opening a tab; editing operations open a Docs tab automatically.
IMPORTANT: User may use multiple Google accounts. ALWAYS CALL console.log(await googleAccounts.list()) to identify the correct account UID when constructing URLs with /u/{uid}/.
js// Parse URL to get docId and uid const { docId, uid } = googleDocs.parseUrl('https://docs.google.com/document/u/1/d/abc123/edit'); // → { docId: 'abc123', uid: 1 } // Read document (cookie-only, no tab needed) const html = await googleDocs.getDocumentHTML('https://docs.google.com/document/u/1/d/.../edit'); const text = await googleDocs.getDocumentText('https://docs.google.com/document/u/1/d/.../edit'); // Or pass { docId, uid } directly const html2 = await googleDocs.getDocumentHTML({ docId: 'abc123', uid: 1 }); // Edit document (opens tab) await googleDocs.connect(url); const title = await googleDocs.getTitle(); const liveText = await googleDocs.getLiveText(); await googleDocs.insertText('Hello world'); await googleDocs.dispose(); // Apply surgical diffs (the killer feature) await googleDocs.connect(url); await googleDocs.applyDiffs([ { type: 'replace', startIndex: 0, endIndex: 5, text: 'Hello' }, { type: 'insert', startIndex: 10, text: ' world' }, { type: 'delete', startIndex: 20, endIndex: 25 }, ]); await googleDocs.dispose(); // Apply diffs as suggestions await googleDocs.connect(url); await googleDocs.applyDiffsAsSuggestions(diffs, 'Fixed grammar issues'); await googleDocs.dispose();
googleDocs.parseUrl(url): { docId: string; uid?: number }Extract docId and uid from a Google Docs URL. Useful for multi-account scenarios where you need to pass { docId, uid } to read methods.
googleDocs.getDocumentHTML(target): Promise<string>Fetch the full document as HTML. target is a URL string or { docId: string; uid?: number }. Include /u/{uid}/ in the URL (or pass uid) for multi-account.
googleDocs.getDocumentText(target): Promise<string>Fetch the full document as plain text. Same target signature as getDocumentHTML.
Call connect(url) before using these, and dispose() when done.
googleDocs.connect(url): Promise<void>Open a Docs tab and wait for the editor to load.
googleDocs.dispose(): Promise<void>Close the Docs tab.
googleDocs.getTitle(): Promise<string>Read the document title from the live editor.
googleDocs.getLiveText(): Promise<string>Read the full document text from the live editor. Note: temporarily selects all text to read it.
googleDocs.getSelectedContent(): Promise<{ text: string; html: string }>Read the current selection as text and HTML.
googleDocs.insertText(text): Promise<void>Insert text at the current cursor position.
googleDocs.selectAll(): Promise<void>Select all document text.
googleDocs.selectTextRange(startIndex, endIndex): Promise<void>Select a range of text by character indices.
googleDocs.insertHtmlContent(html): Promise<void>Paste rich HTML content at the cursor position.
googleDocs.pasteFromMarkdown(markdown): Promise<void>Use Docs' "Paste from Markdown" context menu item.
googleDocs.applyDiffs(diffs): Promise<void>Apply surgical text modifications using select-and-replace. Diffs are sorted end-to-start so later edits don't shift earlier indices.
tsinterface TextDiff { type: 'replace' | 'delete' | 'insert'; startIndex: number; endIndex?: number; // required for replace and delete text?: string; // required for replace and insert }
googleDocs.applyDiffsAsSuggestions(diffs, explanation?): Promise<void>Apply diffs as Google Docs suggestions. Switches to suggestion mode, applies diffs, then switches back. Optionally adds an explanation comment.
googleDocs.addComment(text): Promise<void>Add a comment on the current selection.
googleDocs.deleteSelection(): Promise<void>Delete the currently selected text.
connect() → edit → dispose().applyDiffs() and applyDiffsAsSuggestions() are the primary editing mechanisms — they're precise, index-based, and handle multiple edits atomically.Cmd+ACmd+FCmd+Shift+HCmd+Alt+MCmd+Alt+1 through Cmd+Alt+6Cmd+B, Cmd+I, Cmd+UCmd+Z, Cmd+YOther measured skills in the registry, with their headline benchmark lift.