Save email data to Excel or Google Sheets: one row per email or invoice line

Save email data to Excel or Google Sheets automatically: one row per email or invoice line, read from emails and attachments, never added twice.

The Parser's Output step for Supplier invoices: the Excel workbook card on, writing to \fileserverFinanceInvoices.xlsx with four columns and the table lines on their own tab, and the Google Sheets card on with the Finance Google Drive connection, with a preview of each row on the right

To save email data to Excel or Google Sheets, a program has to read the values out of each email and add them as a row. Mail Attachment Downloader does both: its Parser reads the invoice number, the supplier, the total or any other value from the email and its attachments, and adds one row per email, or one per invoice line, to an Excel workbook or a Google Sheet. Process the same email again and its row is replaced, never added twice.

The examples use Contoso’s mailbox finance@contoso.com, the workbook \\fileserver\Finance\Invoices.xlsx, and invoices from Acme, Northwind and Fabrikam, such as INV-2026-0412.

Three ways to get email attachments into a spreadsheet

  • The Parser’s outputs: the easiest. You show the Parser which values to read, then turn on Excel workbook or Google Sheets. The lines of an invoice table can get a tab of their own.
  • The rule step Add a row to a spreadsheet: a row for each email a PRO rule picks, with any fields the rule has: the sender, the subject, the date, or values its steps found.
  • Save metadata: a CSV file of the email’s details for each saved file, which Excel opens. The simplest log.

What you need

Parse email to Excel with the Parser

  1. On the Parser tab, click New parser and add a few sample emails, such as one invoice each from Acme, Northwind and Fabrikam.
  2. In the Fields step, mark the values: highlight the invoice number in a sample, or describe it in plain words and let the AI find it. See Extract data from email with AI.
  3. In the Output step, choose One record for each: email, or attachment named (such as order_*.pdf) for a row per attachment.
  4. Turn on Excel workbook. Enter the Workbook (.xlsx), such as \\fileserver\Finance\Invoices.xlsx, and the Sheet (empty: the parser’s name).
  5. Under Columns, give each column a Heading and a Value (fields in braces), such as “Invoice number” and {INVOICE_NUMBER}. Fields… picks one, and Every field, as at first puts back one column per field.

The CSV file, the Excel workbook and the Google Sheet share one Columns list, so they hold the same columns. The preview on the right shows the row of the sample you’re on.

Parse email to Excel or CSV: the Output step of the Parser for Supplier invoices, one record for each email, the Columns list Invoice number, Invoice date, PO number, Due date, Total and Supplier with fields in braces, a CSV preview of sample INV-2026-0412, and Run it again and nothing doubles
The Output step: one Columns list for the CSV file, the Excel workbook and the Google Sheet.

Before you turn it on, click Test on the card, then Try the write on a temporary copy: it writes into a copy of the workbook, shows it, and deletes the copy. Your workbook is only read.

The Parser's Output step for Supplier invoices: the Excel workbook card on, writing to \\fileserver\Finance\Invoices.xlsx with four columns and the table lines on their own tab, and the Google Sheets card on with the Finance Google Drive connection, with a preview of each row on the right
The Parser’s Output step: the same row to an Excel workbook and a Google Sheet, and the invoice lines on a tab of their own.

Save email to Google Sheets

Google Sheets is reached through a Google Drive connection you make once with your own Google Cloud app:

  1. In the Google Cloud project of that app, enable the Google Sheets API as well as the Google Drive API.
  2. Add the connection in Settings › Sources › Cloud Connections. Save email attachments to SharePoint, OneDrive, S3 or Google Drive shows how.
  3. In the Google Sheet, add the tab the rows go to.
  4. In the Parser’s Output step, turn on Google Sheets, pick the Google connection, paste the Address of the Google Sheet from the browser, and enter the Tab.

The values leave your computer for Google, so the Parser asks first and names where they go. Its Test, Write one test row…, writes to a tab called PARSER TEST, shows it and removes it again. Values go in as plain values: a text that starts with = is never run as a formula.

One row per invoice line

Many invoices are a table of lines. When the parser reads a table, the Excel workbook and Google Sheets cards offer Also write the table lines. The lines go to a tab of their own, one row per line, the email’s key first, so a lookup joins them to the email’s row. Under Repeat on each line, choose The email’s key only, Every field the parser reads (the supplier and the invoice number on each line, ready for a pivot table), or Choose fields….

Email invoice lines to a spreadsheet: the Parser's table lines with columns description, qty, unit and amount read from INV-2026-0412.txt, adding up to the subtotal 416.50, written as one row for each line
A table of invoice lines: written as one row for each line.

Run it again and nothing doubles

Each row starts with the email’s key (its account and message), kept in the first column. When the same email is processed again, after you correct a value in Needs you or with Process again…, its row is replaced, and its invoice lines are replaced where they were. Other emails’ rows are not touched.

A value is a number only when it is plain digits, so an invoice number like 00123 keeps its zeros.

Add a row to a spreadsheet in a PRO Rule

With PRO Rules Client or PRO Rules Server, any rule can add a row:

  1. On the PRO Rules tab, click New rule… or Edit, and set Which emails, such as the sender’s domain acme.example.
  2. Under Then, click Add a step…, open Data and fields and double-click Add a row to a spreadsheet.
  3. In Where the rows go, choose An Excel workbook (.xlsx) or A Google Sheet.
  4. Enter the Workbook file, or address of the Google Sheet, and the Sheet or tab (Parsed to begin with). A Google Sheet also needs its Google connection.
  5. Under Columns, click Add a column for each one: a heading and a value such as {FROM}, {SUBJECT}, {DATE} or {TOTAL}.

The step adds one row for each email, after the email is processed. For values from inside the attachments, put Find fields with AI or Find fields in the file before it.

Email attachments to spreadsheet: the Add a step window with Data and fields chosen, showing Find fields in the file, Find fields with AI, Look up from a database, Save to a database, Store CSV / SQL, Save metadata, Fill a template, Run an AI prompt and Add a row to a spreadsheet
Add a step › Data and fields › Add a row to a spreadsheet.
Mail Attachment Downloader's Add a row to a spreadsheet step: rows go to the Excel workbook \\fileserver\Finance\Invoices.xlsx, sheet Invoices, with the columns From, Subject, Received and Total from the email's fields, once per email
Add a row to a spreadsheet: one row per email, replaced if the same email comes again.

The simplest log: Save metadata to a CSV file

If you only need who sent what and when, the Save metadata step adds a line for each saved file to a CSV file, with the email’s details: the file’s name, the sender, the recipients, the subject and the date to begin with. Tick Add to the file when it is there (otherwise replace it) to keep one running log, and open it in Excel.

The Save metadata step in the Rule Editor for Supplier invoices: a CSV file in the save folder with the columns file name, original file name, from, to, CC, subject and date, Add to the file when it is there ticked, Run For each saved file
Save metadata: a CSV line for each saved file.

The other way round: Excel attachments into a database

Receive a daily sales report as an Excel or CSV attachment? With PRO Rules Server, the Store CSV / SQL step reads its rows and adds them to a database table. See Save CSV and Excel attachments to a database.

The Store CSV / SQL step for Fabrikam daily sales: data source Contoso Finance, table dbo.SalesLines, an INSERT statement, and the columns Description, Price and Quantity read from the sheet Daily sales of an .xlsx sample file
Store CSV / SQL: the rows of an Excel attachment into a table.

Questions people ask

Can I save each email to Google Sheets automatically?

Yes. Each email the parser or rule picks adds a row as it is downloaded, on the program’s schedule or as soon as new email arrives.

Does Excel have to be installed?

No. The program writes the .xlsx file itself. Keep the workbook closed in Excel while downloads run: a workbook that is open can’t be replaced, and the step fails until it is closed.

Can I get one row per attachment instead of per email?

Yes, in the Parser: set One record for each to attachment named, such as order_*.pdf.

What leaves my computer?

Nothing for an Excel workbook or a CSV file. For a Google Sheet, the values in the row go to Google, through your own Google app.

Try it: download Mail Attachment Downloader and start with the free edition, or compare the PRO editions, each with a 30-day money-back guarantee.

Related

Questions about this post? Contact us.