Skip to main content
gmail_get_attachment Download and read the content of an email attachment from Gmail. Requires the messageId and attachmentId from the attachments list returned by gmail_get_message or gmail_get_thread. PDFs are extracted to text server-side. Text-based files (CSV, JSON, TXT, HTML, XML) are returned as text. All other formats (DOCX, XLSX, images, etc.) are returned as raw base64 for direct reading.

Parameters

messageId
string
required
Gmail message ID that contains the attachment.
attachmentId
string
required
Attachment ID from the message’s attachments list.
filename
string
Original filename (from attachments list) — used for format detection.
mimeType
string
MIME type of the attachment (from attachments list).