How to Extract Data from Email Attachments (PDF, CSV & Excel)
Try it now: extract email data to Excel, CSV, or JSON
Connect a Gmail or IMAP mailbox to parse new mail automatically, or paste an email below to test the converter now.
Create a free account to download. No credit card required.
Extracting data from email attachments is really two jobs, not one. An email parser reads the message itself, pulling named fields out of the body and listing each attached file by name, type, and size. MailParse on the Plus plan and higher also reads the text inside a digital PDF or CSV attachment, while a scanned PDF or an Excel report is a separate document extraction job. Knowing which kind of file you have is what saves the afternoon. This guide draws the line clearly, then walks the manual and automated route for each side.
Pull the data out of the message itself
MailParse reads the email body and any HTML tables into named fields, lists every attachment by name, and on the Plus plan and higher reads the text inside digital PDF and CSV attachments. For scanned files and Excel workbooks, pair it with a document extraction tool. Try the email parser or read the methods below first.
How do I extract data from email attachments?
To extract data from email attachments, separate the two tasks. An email parser reads the message: it pulls named fields out of the body and turns HTML tables into rows, and it lists each attachment by filename, type, and size. MailParse on the Plus plan and higher also reads the text inside a digital PDF or CSV attachment, so a named field finds the value there. A scanned PDF or an Excel report is a document extraction job, handled by a tool built to open that format. Parse the message and digital files first, then run the scans and workbooks through a document extractor.
The reason this trips people up is that they are different problems. Separating attachments from a message is a mail task. Reading numbers out of a PDF is a document-parsing task. A tool like MailParse does the first well: it reads the message and its tables and tells you exactly which files came attached, and on the Plus plan and higher it reads the text layer of digital PDFs and CSV files too. It does not run OCR or open Excel workbooks, which is why those files need their own step.
Is the data in the email body or the attachment?
Check this first, because it decides which tool you need. Open a sample email and find the value you actually want. If it is typed in the body or sits in an HTML table in the message, an email parser reads it directly and no attachment step is required. If it is only printed inside an attached file, check the file type: MailParse on the Plus plan and higher reads a digital PDF or CSV, while a scanned PDF or an Excel workbook needs a document extractor pointed at that file. Many "attachment" jobs turn out to have the key fields in the body once you look.
| Where the value sits | What reads it | What you get |
|---|---|---|
| Typed in the message body | An email parser | Named fields, one row per email |
| In an HTML table in the message | An email parser | Each table row as a spreadsheet row |
| In a CSV or Excel attachment | CSV: MailParse on Plus and higher. Excel: a spreadsheet import step that maps the columns | Named fields found in the CSV text, or the Excel file reshaped into your columns |
| In a PDF or scanned attachment | Digital PDF: MailParse on Plus and higher. Scan: a document extraction tool with OCR | Invoice or receipt fields from the text layer, or from OCR for a scan |
| You only need the file itself | An email parser | The attachment noted by filename, ready to store or route |
How do I extract data from a PDF email attachment?
A digital PDF attachment can be read by MailParse on the Plus plan and higher; a scanned one needs a document extraction tool. A PDF has no rows and columns underneath, just text positioned on a page. When the file has a text layer, MailParse reads that text, so a named field like invoice total or PO number is found inside the PDF and lands in the same row as the email fields. A scan has no text layer and MailParse does not run OCR, so save that file, or have your workflow hand it off, then run it through a PDF to Excel converter that turns the file into structured rows.
Invoices and receipts are the common case, and they are templated, so a document extractor learns where the invoice number and total live and reads every future invoice from that sender the same way. Pair that output with the fields your email parser pulled from the message, and you have the whole record.
How do I parse a CSV or Excel attachment?
CSV and Excel attachments already hold rows and columns, so they are easier, but the work is rarely "just open the file." Real attachments carry junk header rows, merged cells, totals stuck at the bottom, inconsistent date formats, and column orders that shift between senders. Handling them means a spreadsheet tool or import step that maps each new file to the columns you care about, no matter how the source arranged it. On the Plus plan and higher MailParse reads the text of a CSV attachment, so a named field finds a total or reference in it; an Excel .xlsx attachment is not read, so that file still goes through a spreadsheet import step that reshapes it.
How do I save attachments from Outlook in bulk?
Outlook can save attachments in bulk through a VBA macro that loops over messages in a folder and writes each file to disk, and Power Automate can do the same with a cloud flow. Both get the files out, but neither reads the data inside them, so you end up with a folder of 300 PDFs and the real work still ahead. Saving attachments is the easy part; turning 300 saved PDFs into 300 clean rows is a separate document extraction step. We cover the Outlook message side in our guide to extracting data from Outlook emails.
Can Power Automate extract data from email attachments?
Power Automate can detect an incoming email, save its attachments, and write rows to a table, and with the paid AI Builder add-on it can read fields out of standard documents like invoices. For simple, consistent attachments inside a Microsoft 365 shop, that can be enough. The limits show up with varied layouts, scanned PDFs, and tables that span pages, where the built-in actions flatten or miss data and the document-reading capability sits behind a separate license. We compare the approaches in how to parse an email body in Power Automate.
How do I handle attachments across many emails in bulk?
Process at the mailbox or file-batch level rather than one message at a time. Connect the inbox or feed in a batch of .eml or .msg files, and an email parser walks every message, captures the body and table fields, and lists the attachments on each one into a single output, reading digital PDF and CSV attachment text on the Plus plan and higher. Route scanned files and Excel workbooks to a document extractor in the same pass. With an email parser API you can pipe the message data through at scale and push the structured results straight to a database or accounting system through a webhook, then merge in the document extraction results for the scanned files.
Putting it together
The honest decision tree is short. First, find where the value lives. If it is in the message body or an HTML table, an email parser reads it directly. If it is inside a digital PDF or CSV attachment, MailParse on the Plus plan and higher reads it in the same pass. If it is inside a scanned PDF or an Excel file, add a document extraction step for that file and combine the two results. If those attachments are invoices specifically, our guide to extracting invoice data from email goes deeper on the AP workflow, including importing the result into QuickBooks, Xero, or NetSuite.
The question that should drive the choice is how many times the same emails keep arriving. If the answer is "every week, forever," automate the message side and the digital attachments, and hand the scans to a document tool. Drop an email into the parser to see the body and table fields it pulls, then decide what the attachments still need.