n8n

How to Automate LlamaParse PDF Invoices to Google Sheets?

Save time on invoice entry by turning invoice emails into clean rows in a spreadsheet. Ideal for finance teams, bookkeepers, and small businesses that receive PDF invoices by email and need fast, accurate records.

The flow watches Gmail for messages with PDF attachments from chosen senders. It skips emails that already have a special label to avoid duplicates. Each attachment is sent to LlamaParse for advanced PDF parsing, and the workflow waits and checks until the job is ready. Parsed content is then passed to an OpenAI model with a structured output parser to extract fields like invoice date, number, supplier, items, and totals. The results are mapped to your column names and appended to Google Sheets. Finally, the source email gets an invoice synced label for traceability.

Set the sender filter, create the invoice synced label, connect your LlamaIndex and OpenAI keys, and pick your Google Sheet. Expect major time savings and cleaner data with fewer mistakes. This setup is great for monthly reconciliation, expense tracking, and vendor management where PDFs vary in layout but must land in one reliable sheet.

What are the key features?

  • Gmail trigger watches for emails with attachments from selected senders and downloads the files.
  • Label screening checks existing labels and skips emails already marked as invoice synced.
  • HTTP upload sends attached PDFs to LlamaParse using multipart form data.
  • Polling loop with Wait and Switch nodes checks job status until parsing completes.
  • Retrieves parsed invoice content from LlamaParse for downstream use.
  • OpenAI model with zero temperature and a Structured Output Parser extracts clean invoice fields.
  • Mapping node aligns extracted values to your Google Sheet column names.
  • Google Sheets append adds a new row for each processed invoice.
  • Gmail action adds the invoice synced label to prevent duplicate processing.

What are the benefits?

  • Reduce manual entry from 15 minutes per invoice to 1 minute
  • Automate up to 90% of invoice data capture from email PDFs
  • Improve data accuracy by 80% with structured parsing and rules
  • Prevent duplicate records using an automatic Gmail label
  • Connect Gmail, AI extraction, and Google Sheets in one flow
  • Handle hundreds of invoices per week with reliable polling

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Gmail, Google Sheets, OpenAI and LlamaIndex. See the Tools Required section above for links to create accounts with these services.
  3. In Gmail, create a label named invoice synced and confirm you can apply labels to messages.
  4. In the n8n credentials manager, open the Gmail Trigger node, choose Credential to connect with, click Create new credential, and follow the on screen steps to grant access. Test the connection.
  5. Open the Gmail Trigger settings and set the sender filter and has:attachment. Ensure Download Attachments is enabled.
  6. In your LlamaIndex account, create an API key. In n8n, create a new HTTP Header Auth credential. Add header name Authorization with value Bearer YOUR_API_KEY and header accept with value application/json. Assign this credential to the Upload to LlamaParse, Get Processing Status, and Get Parsed Invoice Data nodes.
  7. In n8n credentials, create an OpenAI API credential by clicking Create new credential on the OpenAI Model node and pasting your API key from the OpenAI dashboard. Keep temperature at 0 for consistent results.
  8. In Google Sheets, prepare a spreadsheet with the needed columns. In n8n credentials, create a Google Sheets OAuth2 credential and connect your account. In the Append to Reconciliation Sheet node, paste the spreadsheet URL and select the correct sheet tab.
  9. Open the Structured Output Parser node and review the schema. Adjust field names or types if your invoices differ.
  10. Save the workflow, send a test email with a PDF invoice to the watched inbox, and start an execution. Watch the LlamaParse status loop until it returns ready.
  11. Confirm a new row appears in your Google Sheet and that the original email now shows the invoice synced label.
  12. If no data appears, check the Gmail filters and label. If parsing is slow, increase the Wait duration. If fields are empty, tune the extraction prompt or schema and retry.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

Google Sheets

Sign up

Free: $0 (Google Sheets API usage has no additional cost; quota limits apply)

LlamaIndex

Sign up

Free: $0 / mo, includes 10,000 credits; API key available

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.