- Home
- Case studies
- Email invoices are filed automatically into monthly Drive folders
Email invoices are filed automatically into monthly Drive folders
An accounting firm stopped downloading attachments by hand. The system finds invoices in the inbox, extracts their data, and files them in Google Drive.
4 min read
- Client
- Accounting firm based in WrocΕaw
- Industry
- Automation / Finance / Accounting
- Scope
- Invoices, reports and documents
- Delivery time
- 2 days
Who the client was and what was getting in the way
An accounting firm in WrocΕaw. Suppliers send cost invoices to an inbox as PDF attachments. Nothing unusual β that is how most companies work. The problem starts with volume and consistency.
Every invoice had to be opened, its attachment downloaded, the file given a useful name, and then placed in the folder for the right month. With that many documents coming in, this took several hours a month, and the work added nothing beyond moving files from one place to another. There was also the risk that someone would name a file their own way or put it in the wrong folder. Then finding an invoice from six months earlier could take fifteen minutes and end with someone searching folders blindly.
The second issue was the lack of any structured record. The data existed only in PDFs: invoice number, amount, supplier, issue date, and payment due date. To answer how much had gone to a particular supplier in March, someone had to open the files one by one. That information could not be filtered, totalled, or checked for missing entries.
What we built
We built an automation that handles the entire workflow without a person. Every 15 minutes, it connects to the inbox through the Gmail interface and checks new messages for invoices from known suppliers. When one arrives, its attachment moves on for analysis.
We used a language model to read the invoice. It extracts the document number, amount, supplier, issue date, and payment due date. This was a deliberate choice, not a shortcut: every supplier lays out invoices differently, and rigid rules based on where an amount appears on the page break as soon as a template changes. The model can handle the same number appearing in the header on one invoice and at the bottom on another.
The extracted data drives the filing process. The PDF goes into the Google Drive folder for the corresponding month and is named with the date and invoice number, so the folder listing is automatically chronological and easy to scan without opening files. At the same time, all the data is saved in Supabase, where it can be filtered, totalled, and reported on. Node.js ties everything together, and access to email and Drive uses Googleβs official interfaces with permissions limited to what is actually needed.
How it works today
Implementation took two days. We spent two hours mapping the companyβs invoice workflow and what it actually needed. A day went into connecting the inbox and Drive and organizing permissions. Another six hours went into extracting data from documents and saving it to the database. The final two hours were for testing with the clientβs real invoices, not sample files.
The process now runs in the background without anyone watching over it. An invoice arrives by email; it is in Drive under the right date and number, and its data is in the database. The folder structure for future months is created automatically. No one downloads attachments by hand or has to think of a filename.
The outcome
Manually downloading and labelling invoices is no longer on the task list. Finding a document now means querying the database rather than browsing folders. Invoice data can finally be compared and totalled because it is stored in a database, not just in PDFs. We did not measure before and after, so we will not claim a percentage of time saved. The result is simple and obvious: repetitive administrative work no longer takes up anyoneβs time.
What we would do differently
The bottleneck was not the technology but the supplier list. Recognizing an invoice by sender is quick and simple, but if a supplier changes its sending address or a new supplier is added, the document slips past the automation. Next time, from day one we will add a queue for uncertain documents to be confirmed manually, rather than relying only on known senders.
The second lesson is to handle scans and image-based invoices earlier. We got to them later than we should have, even though they cause the most problems during extraction. The third is access to the company inbox and Drive. Those permissions need to be settled at the first meeting because they can hold up an entire implementation day.