export_file
Exports Google Drive files as in-memory content, converting Docs, Sheets, and Slides to a requested format for immediate processing.
Instructions
Export or download a file from Google Drive.
Prefer download_file when saving to disk — this tool returns raw
base64-encoded bytes for binary formats (xlsx, pdf, docx, etc.) that require
manual decoding. Use export_file only when you need the file content in-memory.
For Google Workspace files (Docs, Sheets, Slides) the file is converted to the requested format. For non-Google files the raw content is downloaded.
Supported export_format values: All Google types: 'pdf', 'html' Google Docs: 'txt', 'docx', 'odt', 'rtf', 'epub' Google Sheets: 'csv', 'xlsx', 'ods' Google Slides: 'pptx' Non-Google files: 'raw'
Args: file_id: The Google Drive file ID. export_format: One of the format strings above.
Returns: fileId, name, mime_type, format, encoding ('utf-8' or 'base64'), content. Text formats (txt, html, csv, rtf) are returned as plain strings; all others are base64-encoded bytes. Raises ValueError if the response exceeds a safety cap (see MAX_TOOL_RESPONSE_CHARS in docs/configuration.md for the configured default) — base64 encoding inflates raw file size by ~33%, so binary exports hit this cap at a much smaller file size than text ones. Call download_file instead for anything but small files; it writes raw bytes straight to disk with no base64/JSON overhead.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_id": "<file_id>",
"export_format": "<export_format>"
},
"name": "export_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes | ||
| export_format | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||