Documents & Finance

Extract Invoice Data from Email into Google Sheets

Watch Gmail for supplier invoices, parse the PDF with LlamaParse, extract the fields with AI and add them to Google Sheets.

The Problem

Invoices arrive as email attachments, and someone types the date, number, supplier and line items into a spreadsheet or accounting tool.

How This Template Solves It

A finance assistant receives invoices from a supplier. Each email with an attachment is picked up, the PDF is parsed with its tables intact, AI extracts fields such as invoice date, invoice number, purchase order and supplier details, the data is added to a sheet and the email is labelled as synced.

How It Works

  1. 1A Gmail trigger watches for emails from a chosen sender that have an attachment and no invoice synced label.
  2. 2Sends the PDF to LlamaParse, which keeps tables and structure.
  3. 3An AI chain with a structured output parser extracts the invoice fields.
  4. 4Adds the data to Google Sheets.
  5. 5Applies the invoice synced label so the email is not processed twice.

What You Need

  • A Gmail account
  • A LlamaCloud account for LlamaParse
  • An OpenAI API key
  • A Google Sheet

What Stays Under Your Control

  • Finance checks extracted amounts before booking or paying.
  • Approval and payment stay with your team.

Watch Out For

  • The prompt leaves a field blank when the AI cannot find it. Do not fill blanks with guesses.
  • The author mentions a free LlamaCloud allowance at the time of writing. Check the current limits.

Adapted from a community workflow template. Before publishing we removed credentials, account and file IDs, email addresses and sample data. The original author's setup notes are kept inside the workflow file.

More Documents & Finance Templates

Documents & Finance

Draft RFP Responses from Your Company Knowledge

Extract every question from an RFP document and draft answers from your company documents with an OpenAI assistant.

Starts on: Incoming webhook

GmailGoogle DocsOpenAI+1 more