How to automate filing invoices from email into a spreadsheet
Choose by volume and by where the amount sits. A Gmail filter with Apps Script, or a Zapier or Make flow, suits a few regular vendors, and invoice-capture tools suit high volume. If the job crosses apps and varies by vendor, record it once with Ditto AI and review what it found before the first run.
Start with where the details sit
Filing an invoice usually takes four moves. You find the email, save the PDF to a folder, read the vendor, date and amount, and add a row. Finding and saving are easy to automate. Reading the details is where most setups get fiddly, so check where they sit first:
- In the email itself: almost any tool below can pick them up.
- Only in the PDF: you need something that reads documents, or a person.
- In a scan or a photo: plan to check every row by hand at first.
The options
| Option | How it works | Fits when | Watch out for |
|---|---|---|---|
| Gmail filter and Apps Script | A filter labels invoice emails; a script on a timer saves each PDF and adds a row | You live in Gmail and Google Sheets, and can look after a short script | Reading amounts from PDFs; someone has to own the code |
| Zapier or Make | A trigger on new attachments, then steps that save the file and add a row | Every app in the flow has an integration, and emails state the amount | Details that exist only inside the PDF |
| An invoice-capture tool | You forward invoices to it; it reads each one and exports the fields | High volume, where reading PDFs is most of the work | Another vendor and subscription; your invoices pass through it |
| Recording it with Ditto AI | You do the task once; Ditto builds an agent you review | The task touches Mac apps, or varies by vendor | It runs on your Mac, when you start it |
Gmail filters and Apps Script
Gmail filters can “send email to a label, or archive, delete, star, or automatically forward your mail” (Google). So a filter can label each invoice as it arrives. It can’t save the PDF or add the row.
That takes Google Apps Script. Google’s overview says it “saves scripts to Google Drive, and runs them on Google’s servers” (Google). A short script can find labelled mail with GmailApp.search, save each attachment with Folder.createFile, and add the row with Sheet.appendRow. A time-driven trigger runs it on a schedule, within Google’s quotas.
The amount is the hard part. Opening a PDF with Google Docs turns it into text, but Google warns that tables are “not likely to be detected” (Google). Invoice totals often sit in a table.
Zapier or Make
Zapier’s Gmail integration has a New Attachment trigger. One ready-made Zap is called “Save new attachments from labeled emails in Gmail to Google Drive” (Zapier). A Create Spreadsheet Row step then adds the row (Zapier). Make’s Gmail app covers the same ground: it can “manage the emails, drafts, and attachments in your Gmail account” (Make).
For the fields, Zapier has Email Parser. You send a sample email to a Zapier mailbox and “highlight and name the text” you want. It then extracts the same fields from future emails (Zapier). It reads the email, so it suits vendors who put the amount in the message.
Invoice-capture tools
A whole category of software does only this, usually sold for accounts payable or expenses. You forward or upload invoices, it reads the supplier, dates, totals and tax, and it exports them to accounting software or a spreadsheet. It fits high volume, where reading each PDF is most of the work.
The costs are another vendor, usually another subscription, and your invoices passing through its servers. Test one on your own vendors’ layouts before you commit.
Recording it with Ditto AI
Ditto AI builds an agent from one recording of you doing the task on your Mac. Record one real invoice:
- Open the invoice email and its PDF.
- Save the PDF to the folder you use.
- Add the row to the sheet: vendor, date, amount.
- Say what changes as you go: “the vendor, date and amount come from the PDF; the folder and the sheet stay the same”.
Ditto then lists the steps, the inputs that change next time, and a tool for each step. Before anything runs, it shows you every step, input, tool and permission. Access comes from a fixed table, not from the model, and anything Ditto can’t classify counts as a write.
How each app is reached:
- Gmail, Google Drive and Google Sheets: until Google verifies Ditto’s app, through your own sign-in in Ditto’s browser, rather than an MCP server.
- A folder on your Mac, or an Excel workbook: local tools on the Mac.
- A step nothing can do is marked manual, not faked.
For the first runs, turn on Ask before it creates, sends or changes anything. Then each file and row is shown to you as a draft first. Is it safe to let an AI agent use your accounts? explains the rules behind this.
Which to choose
- A few regular vendors, Gmail and Sheets, and you’re happy with a script: a filter and Apps Script.
- Every app has an integration, and the amount is in the email: Zapier or Make.
- High volume: an invoice-capture tool.
- Mac apps in the mix, or vendors that vary: record it with Ditto AI.
Honest limits
- This task hasn’t been shown end to end on this site yet. The runs proven on real accounts so far used Confluence, and Linear with Apple Notes. Record it once and review what Ditto found before the first run.
- Google goes through your own sign-in in Ditto’s browser for now, until Google verifies Ditto’s app.
- It runs on your Mac, when you start it. If invoices must be filed the minute they arrive, a cloud trigger fits better.
- Reading amounts is the weak point of every option here. Whichever you pick, check the first rows against the PDFs.
To try it on your own inbox, install and set up Ditto AI.