Read Google Docs and Slides

Site docs.google.comTask read-google-docs-and-slidesVersion v9Updated Sep 23, 2026Category document-reading

Extract text from a Google Doc or Slides presentation through a direct readable or text-export URL, and optionally export an authenticated Doc as PDF. This skill was captured from a live agent session on docs.google.com and is published here as a reusable recipe for agents.

NoteSelectors and URL schemes drift as sites change. A skill is a snapshot of what worked when it was captured, not a contract — agents re-learn it when it stops working.

Read text from a caller-provided Google Doc or Slides presentation. Both text paths return {title, text}. Optionally export a Google Doc as PDF when requested.

Use Cases

Use when the caller supplies a Google Doc or Slides URL or ID and needs readable text. Preserve the caller's authenticated browser profile where permissions are required.

Automation Flow

  1. Read the opaque ID from /document/d/{document-id}/ or /presentation/d/{presentation-id}/ in the supplied URL. Never fabricate an ID.
  2. For Google Slides, navigate directly to https://docs.google.com/presentation/d/{presentation-id}/export/txt, then run:
(() => ({title: document.title, text: (document.body?.innerText || document.body?.textContent || '').trim()}))()
  1. For a Google Doc, navigate directly to https://docs.google.com/document/d/{document-id}/mobilebasic, then run:
(() => { const root = document.querySelector('#contents') || document.body; return {title: document.title, text: (root.innerText || root.textContent || '').trim()}; })()
  1. When the caller requests an authenticated Google Doc PDF, from the loaded Doc page fetch https://docs.google.com/document/d/{document-id}/export?format=pdf with credentials and return validated PDF bytes:
(async () => { const m = location.pathname.match(/\/document\/d\/([^/]+)/); if (!m) return {ok:false,error:'Document ID not found'}; const r = await fetch(`/document/d/${encodeURIComponent(m[1])}/export?format=pdf`, {credentials:'include'}); const b = new Uint8Array(await r.arrayBuffer()); let s = ''; for (const x of b) s += String.fromCharCode(x); return {ok:r.ok,status:r.status,contentType:r.headers.get('content-type'),bytes:b.length,pdfBase64:btoa(s),isPdf:b.length >= 4 && s.slice(0,4) === '%PDF'}; })()

Possible Friction Points

  • Google Slides has a direct plain-text export at /presentation/d/{presentation-id}/export/txt.
  • The /mobilebasic suffix is the direct readable representation for a Google Doc.
  • Preserve the caller's authenticated browser profile. An unauthenticated session may return sign-in, access-denied, or error content.
  • For PDF retrieval, check status, contentType, and isPdf before accepting the base64 result.

Call it

GET https://production-sfo.browserless.io/skills?token=TOKEN-HERE&domain=docs.google.com&task=read-google-docs-and-slides