Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.xpander.ai/llms.txt

Use this file to discover all available pages before exploring further.

Invoices arrive in every format, from every vendor, every day. This agent reads all of them overnight - so your finance team walks in to every invoice already processed, structured, and ready to act on.

Tutorial Summary

  • Goal: Automate invoice intake end to end - the agent monitors incoming emails, parses attached invoices in any format, extracts all relevant fields, and pushes a clean structured record to your tracker.
  • Estimated Time: 25–35 minutes to set up
  • What you’ll build: A scheduled invoice processing agent connected to Gmail and Google Sheets - invoices arrive, the agent reads every attachment, extracts and unifies the data, and logs a clean structured record automatically. Ready to connect to an ERP when you are
Every business receives invoices daily - from dozens of vendors, in different formats, in different layouts. A PDF from one supplier, an Excel file from another, a CSV from a third. Someone on the finance or operations team opens each one, reads it, pulls out the amounts and details, and manually logs it somewhere. At low volume it’s manageable. At scale it becomes a daily drain on the team - slow, repetitive, and prone to human error. This agent sits on top of your inbox and handles that entire loop automatically. It watches for incoming invoices, reads every attachment regardless of format, extracts and unifies the data into a consistent structure, and pushes it to your tracker. Right now that’s Google Sheets - but the same agent can be pointed directly at an ERP like Microsoft Business Central, NetSuite, or SAP when your team is ready to take it further. The finance team stops logging. The data is always there, always consistent, always on time.

Key Features

  • Multi-format parsing - The agent reads PDF, Excel, and CSV invoices without any manual preprocessing. Whatever format the vendor sends, the agent handles it.
  • Unified data structure - Every invoice, regardless of how it was formatted by the vendor - gets extracted into the same consistent fields: vendor details, invoice number, dates, line items, amounts, tax, and payment status. One format, every time.
  • Inbox-aware automation - The agent monitors your inbox and processes every invoice as it arrives. No manual trigger needed.
  • ERP-ready - Outputs to Google Sheets out of the box. When you’re ready, the same agent connects directly to Microsoft Business Central, NetSuite, SAP, or any other ERP - no rebuild needed.

Prerequisites

  • Account in xpander.ai
  • Google account - with Gmail access and edit access to your invoice tracker spreadsheet.
  • An invoice tracker Google Sheet - with your column headers set up. The agent will append one row per invoice.

Step-by-Step Implementation

Step 1 - Create the Agent and Attach Your Tools In the xpander.ai agent studio, create a new agent and head to the Tools tab. Add the Gmail and Google Sheets connections. Once authenticated, the operations the agent needs are available immediately - reading emails, fetching attachments, and writing to your sheet.
  • Name: Invoice Processing Agent
  • Model: Claude Sonnet, GPT-4o, Gemini 1.5 Pro, or any other model of your choice
Image
Step 2 - Define the Agent’s Instructions This is the logic the agent follows every time an invoice arrives. Role:
You are an invoice processing agent. Your job is to monitor incoming 
emails, read attached invoices and extract the data into a clean, consistent 
structure.

You handle PDF, Excel, and CSV formats. You detect the file type automatically 
and parse accordingly.
Goal:
For every invoice attachment you process:
- Extract all relevant fields: vendor details, invoice number, invoice date, 
  due date, line items, subtotal, tax, total amount and payment status.
- Unify the data into a consistent format regardless of how the
  vendor structured the original file.
- Append a clean, structured row to the invoice tracker.
Instructions:
Every time you run:

1. Fetch the incoming Gmail message and identify the invoice attachment.

2. Read the attachment - detect the file type from the extension and 
   parse accordingly:
   - PDF → extract text and identify invoice fields
   - Excel → read the relevant sheet and map columns
   - CSV → parse rows and identify the relevant fields

3. Extract and unify all invoice fields into the standard attached structure.
   If a field is missing from the source file, leave it blank.

4. Append one new row to the invoice tracker with all extracted fields.
   Set Payment Status to "Pending" by default.

5. Return a confirmation with the row number, invoice ID, vendor name,
   and total amount.
Image
Once you’re happy with the instructions, hit Save and Publish. Step 3 - Add the Agent to a Workflow Create a new workflow in the xpander.ai builder and add the Invoice Processing Agent as the main node. Add a Summarizer node after it - this condenses the agent’s full output into a short confirmation message that gets returned once the invoice is processed. Configure the Schedule trigger at the starting node and set it to run at a defined cadence - every day, every 6 hours, or whatever matches the volume of invoices your team receives. The workflow fires automatically on schedule, processes every new invoice in the inbox, and logs it. No manual trigger needed.
Image

What the Finance Team Sees

The agent ran overnight. The finance team opens the tracker in the morning and sees every invoice already logged - vendor name, amounts, dates, tax details, all extracted and structured. No data entry. No emails to open. No attachments to download. The team reviews, approves, and acts. The administrative work is already done. From here, the same agent can be pointed directly at Microsoft Business Central, NetSuite, or SAP - the extraction logic stays the same, only the destination changes. Approval workflows, payment reminders, and anomaly detection can all be layered on top. What starts as inbox-to-spreadsheet becomes a fully automated finance intake pipeline.
Image