Export a document
export_documentExport a Google Doc to Markdown, TXT, HTML, PDF, DOCX, ODT, RTF, or EPUB. Text formats return inline; binary formats save to a local file via output_path.
Instructions
Exports the document via Drive. Text formats (markdown, txt, html) are returned inline as the tool result — format=markdown is the way to read a doc as Markdown for a round trip with import_markdown. Binary formats (pdf, docx, odt, rtf, epub) require output_path and are written to that local file (the result reports saved_to and bytes); output_path also works for text formats. output_path must be absolute, and an existing file is never overwritten unless overwrite=true. Exports are capped at 10 MB by the Drive API; comments and suggestions are not part of any export. Nothing in Google Docs changes; the only side effect is the local file when output_path is set.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | Yes | Target format; markdown/txt/html can be returned inline, the rest need output_path. | |
| overwrite | No | Allow output_path to replace an existing file (default false). | |
| document_id | Yes | The document id — the long id from the document URL (docs.google.com/document/d/<documentId>/edit) or from create_document output. | |
| output_path | No | Absolute local file path to write the export to (required for binary formats). Refused if the file already exists, unless overwrite=true. |