Parse invoice data from PDFs using Zapier and AI-powered OCR

Email remains the most common way to receive third-party invoices, but it comes with several drawbacks, including manual data entry from PDFs, the hassle of downloading attachments, and inconsistent layouts that make automated parsing and data extraction difficult. In this article, we’ll explore how to overcome these challenges using AI-powered OCR to extract financial data from invoices received via email, and seamlessly transfer it to Google Sheets with Zapier.

Ingredients

  • Database: A Google Sheet to store the extracted data, and a file folder to store the invoice PDF. Both in stored in Google Drive.
  • Data extraction tool: Cradl AI to extract data from any PDF or image document using LLM-powered OCR.
  • Orchestration: Zapier to transfer data from Cradl AI to the spreadsheet and to the folder in Google Drive.  

Specify the data you want to extract from your invoices

Before we begin, make sure you’ve created a Cradl AI account.

Once you’re logged into Cradl AI, create your first AI model with just a few clicks by cloning the invoice model.

Customise the model to suit your needs by adding or removing fields based on the data you want to extract from your invoices. That's all it takes to create an AI model that understands your invoices!

Screenshot of the model configuration user interface inside Cradl AI

Got tables or line items?

Got tabular data or line items in your invoices that you also want to extract? No problem - just use the Line Items field. For more information on that, this article goes into detail about data extraction from tables.

Import invoices from your mailbox to your AI model

There are several ways to import your invoices into Cradl AI for data extraction.

Email forwarding

Connecting your mailbox to Cradl AI with a forwarding address is an easy and efficient way to automate your imports. Cradl AI auto-generates an email address you can forward your invoice emails to - any email attachment that arrives at this address will be automatically parsed.

Manual bulk upload

Manually downloading your invoices and uploading them to Cradl AI in bulk is always an option for those who prefer a simple and manual approach. This works particularly well if you only process invoices occasionally.

Mailbox monitoring

Zapier can monitor your mailbox (i.e., with Gmail's New Email trigger) for trigger events—such as emails moved to a specific folder or titles containing certain keywords—and send them to the AI tool for processing. If you choose this approach, you want to add Cradl AI's Parse Document or Parse Document With Human-In-The-Loop actions.

In this example, we'll go with the Email forwarding approach.

  1. Select Email from the list of available triggers in Cradl AI.
  2. Click Save to generate a dedicated email address.

Test the integration by sending an email with a document attached to the newly generated address. The document will be automatically processed, and you can view the extracted data inside the Validator in Cradl AI.

Screenshot of the the email trigger user interface inside Cradl AI

Create a Sheet in Google Drive to store invoice data

Now that your AI model is working, we'll connect it with a Google Sheet.

Head over to your Google Drive and create a blank spreadsheet. Add headers that correspond with the fields you want to extract from your documents. In Google Sheets you add headers by simply typing values into the topmost cells:

Screenshot of a Google Sheets sheet with headers configured

Send parsed invoice data to Google Sheets

  1. Head over to Zapier and create a free account.
  2. Use Cradl AI’s pre-built integration with Google Sheets and follow the step-by-step instructions in Zapier.
  3. Map Cradl AI’s extracted fields to your spreadsheet headers.
Screenshot of the Zapier user interface with the Google sheets connector configuration pane

Mapping extracted data from Cradl AI to dynamic Zapier values

When you're mapping Cradl AI's extracted data fields to your spreadsheet's headers, you'll notice that you can choose from way more fields than the handful you defined in your spreadsheet's headers.

99% of the time you are looking for those values that are prefixed with Validated Predictions and suffixed with Value, such as Validate Predictions Purchase Date Value, Validate Predictions Total Amount Value, and so on.

Screenshot of the Zapier user interface with the Google sheets connector step 2 configuration pane

Test your invoice data extraction Zap

Once your Zap is activated, the automation is ready to run:

  1. Forward an email with an invoice attachment to your Cradl AI email address.
  2. Cradl AI will automatically process the document and display the extracted data in the Validator interface.
  3. Review the extracted data for accuracy, correct any flagged errors, and click Validate to confirm.
Screenshot of an extracted invoice in Cradl AI


Clicking Validate triggers the Zap, sending the data directly to your Google Sheet. Within seconds, your spreadsheet will update with the extracted values.

Screenshot of an Excel sheet with extracted data

Saving the invoice PDF to Google Drive

Now that we've successfully extracted data from the invoice, let's ensure we keep the original file organized as well.

Create a folder in Google Drive

First, go to Google Drive and create a new folder to store your invoices.

Screenshot of a folder in Google Drive

Add Google Drive to your Zap

Return to Zapier and add Google Drive as the third step in your Zap.

Configure the Upload File action

  1. In the Setup tab, select Upload File as the action event.
  2. For the file content, choose the Document File Content value from Cradl AI. No additional configuration is needed.
  3. Test the step to ensure everything is working correctly.
Screenshot from a Zapier flow

Your original invoice PDF should now be securely stored in Google Drive, keeping everything organized!

To run the entire Zap in a live environment, make sure you have published the Zap. Otherwise, it will only work in test mode. Happy Zapping!

Screenshot from Google Drive

If you would like a version of this tutorial that does into more detail, this video has got you covered.

You might also be interested in

Try for free today

We’ll help get you started with your document automation journey.

Schedule a free demo with our team today!