DevConnectDevConnect
Sign up · Log in
← back to the feed
1

AI Invoice & Receipt Data Extractor

An automation that reads invoices and receipts — PDFs or photos — and automatically extracts vendor, date, amount, and spending category, logging the results directly into a spreadsheet. Built with n8n, Gemini Vision API, Google Drive, and Google Sheets — with an optional live web dashboard. The Problem Manually typing invoice and receipt details into a spreadsheet is one of the most tedious, repetitive parts of bookkeeping. It's slow, error-prone, and eats up hours that could go toward higher-value work. This system removes the manual data-entry step. Upload a file, and within seconds the key details are extracted and ready for review — turning a tedious task into a quick glance-and-confirm. How It Works Invoice/receipt uploaded (Google Drive folder or web dashboard) │ ▼ n8n detects the new file (Google Drive Trigger / Webhook) │ ▼ File converted to base64 │ ▼ Gemini Vision reads the document and extracts structured data │ ▼ Response parsed into clean fields │ ▼ Row added to Google Sheets (+ returned live to dashboard, if used) Upload — A file is added to a watched Google Drive folder, or submitted through the web dashboard. Trigger — n8n detects the new file automatically. Vision extraction — The file is sent to Gemini's vision model, which reads the document directly (no OCR pre-processing needed) and returns structured JSON: vendor, invoice date, invoice number, amount, and a guessed spending category. Parsing — The AI's response is cleaned and mapped into consistent spreadsheet columns. Logging — The extracted data is appended as a new row in Google Sheets, ready for review. Tech Stack Tool Purpose Google Drive File upload / storage location n8n Automation engine connecting every step Gemini API (Vision) Reads the invoice/receipt and extracts structured data Google Sheets Stores extracted results HTML/CSS/JS Optional front-end dashboard for live demo/upload All core tools used are free-tier. Setup 1. Google Drive Create a folder (e.g. Invoice Uploads) to watch for new files. 2. Google Sheets Create a spreadsheet with these column headers: Vendor, Invoice Date, Invoice Number, Amount, Category, File Name. 3. n8n Workflow (folder-based) Import invoice-receipt-extractor.json and configure: Google Drive Trigger → watch your upload folder Gemini - Extract Data → add your Gemini API key Google Sheets - Add Row → connect your sheet Activate the workflow so it polls automatically instead of requiring manual runs. 4. (Optional) Live Webhook Version For a dashboard-connected, real-time version, import invoice-extractor-webhook.json instead/in addition. This exposes a webhook URL that accepts a file directly from a web page and returns the extracted result instantly. Copy the production webhook URL from the Webhook node Paste it into invoice-dashboard.html where indicated (WEBHOOK_URL constant) Open the HTML file in a browser to use the live upload dashboard Example Output Input: A photo of a pharmacy receipt Extracted output: Vendor Date Amount Category Medicare Pharmacy 6/9/2023 $175.00 Professional Services Limitations This is built for demonstration and small-scale use. Worth knowing before relying on it for real accounting: Not 100% accurate — messy handwriting, unusual formats, or low-quality photos can cause misreads. A quick human review is still recommended, especially for financial records. Category guessing is approximate — the AI selects from a fixed list of common categories and may not always match a business's exact chart of accounts. Not a replacement for a bookkeeper or accounting software — it's designed to reduce manual entry time, not to serve as an audited financial record system. Possible Improvements Add a review/approval step before data is written to the sheet Support multi-page PDF invoices with itemized line-item extraction Add duplicate-detection to avoid logging the same receipt twice Connect output to accounting software (e.g. QuickBooks, Xero) via API instead of Google Sheets About Built by Hania Khattak as part of a portfolio of AI automation projects. Feel free to fork, adapt, or reach out with questions.
0:00 / 0:00
Add a comment
0/2000