Create a zap using Invoice OCR API
Step by step guide for a zap enabling to extract Invoices key information from email attachments and copy them on a Google sheet.
In a typical expense process, invoices that are emailed to your company will have to be saved locally to a computer, and then re-uploaded into an invoicing system. Maybe, even worse, the document must be opened and the details manually entered into the system.
In this post, we’ll build an invoice processing system: invoices that arrive via email will be automatically extracted, and all the data inserted into a Google Sheet.
The best part: No coding required! It will “just work” and will be completely “hands-free” - all the work will be done automatically! If a Google Sheet is not your desired outcome - there are thousands of apps connected with Zapier, so this tutorial can be easily modified to interact with any other application.
The tools required:
- A Gmail based email account.
- A free Zapier account (sign up at Zapier.com)
- A Mindee account with an API key.
Zapier
Zapier is a no code service that connects different tools with a secure no-code interface.
They call the connections "Zaps". Each Zap has a "trigger" an event that starts the process, and an "action" that occurs after the trigger has fired.
In the case of the Zap we are building, you will need a premium account.
If you are a new user (or if you have a new Zapier account), you'll have free premium access for a week (but your Zap will turn off when the trial ends).
Once you have created a Zapier account, you’ll land at the app dashboard. Click the black "Create” button:
Then Click on Zaps
A workflow builder interface is then displayed, with a COPILOT. You can enter in the copilot chat the following text:
When a new email is received on my Gmail account with an attachment, Extract the data using Mindee OCR and send the extracted data to a google sheet.
You can then validate the 3 steps by clicking on the + within the copilot.
Let’s Now configure each step:
Step 1 Gmail
Make sure the Trigger Event is New Attachment.
In an ideal world, you’d set up an address like invoices@<yourcompany>.com
.
For this demo, I used my Mindee email account.
The next step allows you to filter the emails based on the Gmail label or search string.
Here is where I am able to isolate to just emails with invoices:
to:[email protected] has:attachment
Here I am using a Gmail trick to ensure that only invoices emailed to me are parsed by the Zap.
With Gmail — you can add any value after the + and it acts as a unique email address — but arrives in the same inbox.
You can configure which mailbox, or add keywords to ease your finding of a test email.
The search also requires that there is an attachment in addition to being sent to my email address.
Now Zapier will test this trigger to find an email in the account that matches your search query (so now - quickly send an email -with an invoice attachment- to the Gmail account you’ve chosen, so that the search query succeeds).
Once you find the email with the correct attachment, Click on continue with selected record to continue configuring your ZAP.
Step 2 Mindee OCR
First define you Action event and validate Mindee Invoice Parsing is chosen.
Then connect your Mindee Account.
A popup will open with a form, where you will be asked to:
- Enter your account name
- Enter an API key.
If you do not have a Mindee Account, you can create one on the Mindee platform.
Then create an API Key by following this how to.
Once connected to your Mindee account, click on Continue.
Under Your document, choose the option: Attachment (Exists but not shown) and click on Continue.
You can now pick the email you have sent with the Invoice sample. Click on Continue.
Step 3 Google Sheet
We've extracted the data from the Gmail attachment - now we want to do something with that attachment.
For the Setup, Select the following:
- Action Event: Create Spreadsheet Row.
Then, connect your Google account to Zapier.
In this example, we'll add a row in a Google Sheet with all the details from the invoice:
First let’s create the google sheet:
On your Drive:
- Create a new Google Sheet: In our Example Zapier extraction.
- Rename the sheet: Invoices
- Add as headers the fields you want to extract. You can propose the name your want here, as in a next step we will add amaping between the payload of Mindee and the columns on the Google sheet. Don’t forget to add the name of the file !
Now, let’s configure the component. In this example we limited the number of fields to be copied to the Google Sheet but the Invoice API propose more than 25 fields.
For each column of your file map it to a key from the Mindee payload. Each field can propose several features. By Default choose the value.
Once the mapping is done Click on Continue.
That’s it. Now you can name your Zap and turn it on for use!
Testing your Zap
Now you can test your Zap by sending another email to your account with an invoice, and after a few minutes - you’ll see the values appear in your spreadsheet automatically from the Zap.
No coding with Mindee
With just a few minutes of work (and with zero coding), we have build a fully functional invoice processing system - invoices sent as email attachments are automatically identified, extracted, and the results are placed in a Google Sheet.
We're very excited about the possible opportunities that no-coding options can bring to the Mindee Community!
Updated 26 days ago