LOW / CODEBlueprints
financeai

AI Invoice Data Extractor

Receive invoices via email in Gmail, use Claude AI to extract vendor name, amount, date, and line items from the email body, then automatically populate a Google Sheet and notify your team on Slack.

Intermediate~25 minn8nMake.com 296 downloads 965 views

Setup Instructions

1. In Gmail, create a filter or label (e.g., "Invoices") for incoming invoice emails so your automation can target them. 2. In your automation platform, add a Gmail trigger node that watches for new emails with the "Invoices" label. 3. Add a Set/Function node to extract the email body (plain text or HTML) and any attachment names. 4. Add an HTTP Request node to call the Claude API (POST https://api.anthropic.com/v1/messages). Set headers: x-api-key: {{YOUR_ANTHROPIC_API_KEY}}, anthropic-version: 2023-06-01, Content-Type: application/json. Use model claude-sonnet-4-20250514. 5. In the request body, send the email content and instruct Claude to return JSON with fields: vendor, invoiceNumber, date, totalAmount, currency, and lineItems (array of {description, quantity, unitPrice, total}). 6. Parse Claude's response and connect a Google Sheets node to append a row to your "Invoice Tracker" spreadsheet with columns: Date Received, Vendor, Invoice #, Amount, Currency, Line Items (JSON string), Status. 7. Add a Slack node to post a notification to #finance with the extracted vendor, amount, and invoice number. 8. Test by forwarding a real or sample invoice email and verifying the extracted data appears in your sheet.
Troubleshooting
**Claude failing to parse HTML emails:** Strip HTML tags before sending to Claude, or instruct Claude to ignore HTML markup. A simple regex or built-in HTML-to-text node works well. **Line items not extracted accurately:** For complex invoices, include an example in your Claude prompt showing the expected JSON output format. Few-shot prompting significantly improves extraction accuracy. **Gmail trigger missing emails:** Ensure the label/filter is applied automatically and the automation has read permissions for the mailbox. Check that the trigger polls frequently enough (every 5 min recommended). **Google Sheets row formatting issues:** Numbers extracted as strings will not sum correctly. Add a Set node after Claude's response to explicitly cast amount fields to numbers before writing to Sheets.

Need a custom version?

We can build a tailored automation workflow for your specific needs.

New blueprints weekly

Get notified when we publish new automation workflows.