How to Extract Data from Invoices with Gemini AI

In this step-by-step tutorial, you’ll build an invoice data extraction workflow that starts whenever a new invoice is added to a specific Google Drive folder. Gemini analyses the invoice, extracts the required fields, and makes the results available as dynamic variables for the next steps in the workflow.

You can then use the extracted invoice data to send emails, update Google Sheets, route invoices for approval, populate your bookkeeping system (like Quickbooks), update data in your CRM (Hubspot, Monday.com. Zoho etc.), validate invoice details, create records, or continue a larger accounts payable automation process.

Watch a video guide: How to extract data from invoices with Gemini AI

What you’ll learn

  • How to start an invoice workflow when a file is added to Google Drive

  • How to configure a Google Drive trigger in Zenphi

  • How to connect Zenphi to Google Workspace

  • How to select the Drive and folder that Zenphi should monitor

  • How to use Gemini AI to extract structured data from invoices

  • How to define the invoice fields you want Gemini to identify

  • How to assign clear names to extracted fields

  • How to use extracted invoice data in later workflow steps

  • How to add dynamic variables to emails and other actions

  • How to test the workflow with a sample invoice

How the invoice extraction workflow works

The workflow begins with a Google Drive trigger. Whenever an invoice is uploaded to the selected folder, Zenphi starts a new workflow instance automatically.

The invoice is then passed to a Gemini AI action configured for document data extraction. You define the information Gemini should return, such as:

  • Invoice number

  • Invoice date

  • Supplier name

  • Supplier address

  • Purchase order number

  • Subtotal

  • Tax amount

  • Total amount

  • Currency

  • Payment due date

  • Line-item information

Each extracted field is given a clear output name. These outputs can then be mapped into later workflow actions as dynamic variables.

For example, you can add a step to your Zenphi workflow that would automatically send an email containing the extracted invoice details. Or you can add the data to a designated spreadsheet. Or use the same Gemini AI action to compare the invoice against a purchase order, automating two-way matching. Watch this tutorial on How to automate two-way matching. Also, you might need to extract table data — watch this guide How to extract tables from PDF to Sheets

What you’ll learn

  • How to start an invoice workflow when a file is added to Google Drive

  • How to configure a Google Drive trigger in Zenphi

  • How to connect Zenphi to Google Workspace

  • How to select the Drive and folder that Zenphi should monitor

  • How to use Gemini AI to extract structured data from invoices

  • How to define the invoice fields you want Gemini to identify

  • How to assign clear names to extracted fields

  • How to use extracted invoice data in later workflow steps

  • How to add dynamic variables to emails and other actions

  • How to test the workflow with a sample invoice

How the invoice extraction workflow works

The workflow begins with a Google Drive trigger. Whenever an invoice is uploaded to the selected folder, Zenphi starts a new workflow instance automatically.

The invoice is then passed to a Gemini AI action configured for document data extraction. You define the information Gemini should return, such as:

  • Invoice number

  • Invoice date

  • Supplier name

  • Supplier address

  • Purchase order number

  • Subtotal

  • Tax amount

  • Total amount

  • Currency

  • Payment due date

  • Line-item information

Each extracted field is given a clear output name. These outputs can then be mapped into later workflow actions as dynamic variables.

For example, Zenphi can automatically send an email containing the extracted invoice details, add the data to a spreadsheet, compare the invoice against a purchase order, or route the invoice to the correct approver.

Book a call to learn more

If you’re a Zenphi customer and need help with your data extraction workflows, contact support. If you’re not a Zenphi customer, and would like us to look into your use case that involves data extraction, please book a call here.