OpenClaw Google Drive: getting facts out of your docs
Aperisa ยท 7 min read
A Google Doc isn't a file you can download. Drive's API makes you export it, and caps the export at 10 MB. Most OpenClaw Google Drive guides stop at "connected," which is the step before your agent tries to read a 40-page Doc, a scanned PDF and a spreadsheet in one question.
To get facts out of Drive for an OpenClaw agent: connect through gog or the gws skills, authorize a read-only Drive scope, export native Google files to text or Markdown, send PDFs through OpenClaw's pdf tool, and return the file's link and modified date with the answer. Our view: an answer from a document is only as good as your ability to open that document and check it.
How do you connect OpenClaw to Google Drive?
Three routes come from OpenClaw or Google-adjacent repos. The rest of the first page for this keyword is hosted connectors, which handle OAuth for you and list their action counts.
The bundled gog skill. OpenClaw's gog skill runs the gog CLI through the shell. The Drive and Docs lines it teaches:
Assembled from the OpenClaw and gog docs as of October 2026. We haven't run it on a live install, so check it against your version.
gog drive search "query" --max 10
gog docs cat <docId>
gog docs export <docId> --format txt --out /tmp/doc.txt
gog as an MCP server. gog mcp exposes typed read tools by default, including drive_search, drive_get, docs_get ("Read a Google Doc as wrapped text, optionally one tab or all tabs") and sheets_read_range, per the gog MCP guide. OpenClaw registers it under mcp.servers like any stdio server:
{
mcp: {
servers: {
drive: {
command: "gog",
args: ["--account", "you@example.com", "--readonly", "mcp", "--allow-tool", "drive_search,drive_get,docs_get"],
},
},
},
}
The gws skills. The googleworkspace/cli README includes an OpenClaw setup: copy skills/gws-drive into ~/.openclaw/skills/. The same README says it "is not an officially supported Google product" and is "under active development."
The skill routes need exec. The MCP route doesn't, which matters if the same agent reads untrusted files. A shared Doc can carry instructions as easily as an email can, and OpenClaw's prompt injection docs list "docs" and "attachments" among the untrusted content an agent reads.
Which Google Drive scope should OpenClaw get?
drive.readonly. Google's Drive scopes page describes it as "View and download all your Drive files." The full drive scope is "View and manage all your Drive files." Both are classed as restricted.
gog's default Drive service requests the full scope, per its README. Its auth add reference has a --drive-scope flag with a readonly mode, and a --readonly flag that "also requests read-only OAuth scopes":
gog auth add you@example.com --services drive --drive-scope readonly
Read the consent screen. "View and download" is right. "Manage" or "edit" means stop. One catch: gog's docs and sheets services request drive plus the Docs or Sheets scope. If you authorize them, check what the consent screen asks for again.
You'll see drive.file suggested because Google lists it as non-sensitive. It only covers files the app created or files a user opened or shared with the app, so an agent can't search your existing Drive with it.
Why do Google Docs and PDFs trip up OpenClaw agents?
Because "a file in Drive" is several different things, and each one needs its own path to text.
Native Google files need export
Drive's download and export guide splits files in two. Blob files download with files.get and alt=media. Google Workspace documents go through files.export with a target MIME type, and "Exported content is limited to 10 MB."
The export formats table lists text/plain and text/markdown for Docs. For Sheets, CSV and TSV come with a note in the table: "first sheet only." An agent that exports a workbook to CSV and answers from it has read one tab and doesn't know it.
gog's docs export defaults to --format pdf. Fine for a human. For an agent, ask for text:
gog docs export <docId> --format md --out /tmp/contract.md
gog drive download <fileId> --format md
For Sheets, read ranges (gog sheets get <sheetId> "A1:D50" --json, or sheets_read_range over MCP) instead of exporting.
PDFs go through the pdf tool
Uploaded PDFs are blob files. Download them, then let OpenClaw's pdf tool read them. Per its docs, it uses native document input on Anthropic and Google models and falls back to text and image extraction for other providers. Two defaults to know: a 10 MB per-PDF cap (agents.defaults.pdfMaxMb) and agents.defaults.pdfMaxPages at 20, which limits how many pages a request selects. When a selection is shortened, the docs say both models get a partial-document notice. Make sure your agent passes that notice on instead of answering as if it read the whole contract.
A scanned PDF has no text layer. What comes back depends on whether the model reads the page images, so test with one of yours before you trust the setup with a stack of them.
How should an OpenClaw agent cite the Drive file?
With a link you can tap from Telegram, and a date. Drive's files resource gives you both: webViewLink, "A link for opening the file in a relevant Google editor or viewer in a browser," and modifiedTime, "The last time the file was modified by anyone."
gog drive get <fileId> --fields id,name,modifiedTime,webViewLink --json
Then set the reply shape in the agent's instructions. With made-up data:
Notice period: 60 days.
Source: Harbor Lane MSA, Amendment 2 (modified 2026-08-14)
https://docs.google.com/document/d/EXAMPLE/view
The date does real work. If the agent cites a version from March and you know there was an amendment in August, you catch it in one glance. Without the date, you catch it when the client does.
Should the agent read Drive live or from an index?
It depends on the question. "What does the Harbor Lane amendment say about notice?" is one file, and a live read is fine: search, export, read, cite. "Which clients renew in the next 60 days?" means reading every contract on every question. That is slow, it fills context, and the 10 MB and 20-page limits start to matter.
The other option is an index built ahead of time: extract the fields once, keep a copy, refresh it when files change, and let the agent query the result. Faster and cheaper per question. The tradeoff is a stored copy of your documents and a sync to trust. Know which one you're choosing, and make either one return the file it answered from.
Where does Aperisa fit?
Aperisa is one example of the index approach. It reads Gmail, Drive, Calendar and Contacts with read-only Google access, plus the bank accounts you link, and keeps a searchable copy to answer from. It maps those records into one structured record and serves it through a read-only remote MCP server with no send, write or delete tools. It looks up your records instead of asking a model to recall them, and answers come with the email or document they came from.
Read-only, as text, with the link
OpenClaw can reach Google Drive in an afternoon. Getting checkable facts out of it takes four choices: a read-only Drive scope, text exports instead of PDFs for native files, the pdf tool with its page limits in mind, and a link plus modified date on every cited file. Get those right and a wrong answer is one tap from being caught.
For the inbox side, see OpenClaw Gmail read-only. For why notes in memory go stale on facts like these, see OpenClaw memory.
Aperisa connects as a remote MCP server over Streamable HTTP with a Bearer key, and each key can be limited by data area and level of detail. Try it out.
FAQ
How do I connect OpenClaw to Google Drive? The common routes are OpenClaw's bundled gog skill, gog running as a stdio MCP server under mcp.servers, or the gws CLI's Drive skill copied into ~/.openclaw/skills. Hosted third-party connectors exist too. Whichever you pick, check the Drive scope it asks for.
Can OpenClaw read Google Docs? Yes, through export. A Google Doc has no file bytes to download, so Drive's API exports it to a format such as plain text, Markdown, PDF or DOCX, with a 10 MB limit on exported content. gog docs export defaults to PDF, so pass --format md or txt when an agent will read the result.
Which Google Drive scope is read-only? drive.readonly. Google describes it as View and download all your Drive files. The full drive scope is View and manage all your Drive files. gog's default Drive service requests the full scope, so authorize with --drive-scope readonly or --readonly.
How should an OpenClaw agent cite a Drive file? Return the file name, its modifiedTime and its webViewLink with the answer. Google describes webViewLink as a link for opening the file in a relevant Google editor or viewer in a browser.
Sources
- Google: Drive API scopes
- Google: Download and export files
- Google: Export MIME types for Workspace documents
- Google: Drive API files resource
- OpenClaw docs: PDF tool
- OpenClaw docs: Prompt injection
- OpenClaw gog skill (SKILL.md)
- gogcli README
- gogcli MCP guide
- gogcli: gog auth add reference
- gogcli: gog docs export reference
- googleworkspace/cli README
Questions
How do I connect OpenClaw to Google Drive?
The common routes are OpenClaw's bundled gog skill, gog running as a stdio MCP server under mcp.servers, or the gws CLI's Drive skill copied into ~/.openclaw/skills. Hosted third-party connectors exist too. Whichever you pick, check the Drive scope it asks for.
Can OpenClaw read Google Docs?
Yes, through export. A Google Doc has no file bytes to download, so Drive's API exports it to a format such as plain text, Markdown, PDF or DOCX, with a 10 MB limit on exported content. gog docs export defaults to PDF, so pass --format md or txt when an agent will read the result.
Which Google Drive scope is read-only?
drive.readonly. Google describes it as View and download all your Drive files. The full drive scope is View and manage all your Drive files. gog's default Drive service requests the full scope, so authorize with --drive-scope readonly or --readonly.
How should an OpenClaw agent cite a Drive file?
Return the file name, its modifiedTime and its webViewLink with the answer. Google describes webViewLink as a link for opening the file in a relevant Google editor or viewer in a browser.
Published
Keep reading
- OpenClaw MCP setup: a remote server with a Bearer header
OpenClaw MCP setup for a remote server with a Bearer header: mcp.servers, not mcpServers or mcporter, an env-backed token, and 2026.6.5 or later.
- n8n MCP Client node: connect a remote MCP server, and fix a missing auth header
Set up the n8n MCP Client and MCP Client Tool nodes against a remote MCP server, and fix the missing Authorization header behind most 401s, step by step.
- MCP API key config security, harness by harness
MCP API key config security for OpenClaw, Hermes, Cursor, Codex CLI and n8n: where each can read a key from, what is still plaintext, and the OS keychain route.