Processes Purchase Invoices Automatically Using Aito.AI and Google Sheets
Predict GL codes for purchase invoices using Aito on Google Sheets and Robocorp.
Summary: Example robot that uploads and historic dataset of purchase invoice data to Aito, and then reads more new invoices from Google Sheet and assigns them GL Codes based on ML predictions.
Prerequisites and preparations
You will need to complete the following steps in order to run the robot yourself. Should you need help, there is also a way more detailed description of setting the environment here with another use case.
GOOGLE GCP + TARGET SHEET
- You'll need to have a Google account and be able to create Sheets. Take a copy of my example sheet and copy it locally to your Google Drive.
- Follow the steps described here to create a GCP Service Account, and the necessary JSON file. I have included an example file. That should be replaced with the real service account file (not EXAMPLE in the name obviously).
- Add your Google Sheet ID in to
vault.json. There is an example file that makes it easy to spot the right place. Just remove the EXAMPLE from the name.
- Next you'll need an Aito account and intance. Start by creating a free account here.
- Log in to Aito account, and create an instance. Sandboxes are free. Take a note of your instance URL and read write API key after creation is ready.
- Add URL and API key to
vault.jsonfile. This is the same file where you already added the Google Sheet ID.
What does it do
The robot is split in to two main files:
AitoRFHelper.py. Former takes care of the main workflow in two tasks as described below. The latter serves as a helper and does things like Aito schema creation, and predictions that are just easier in Python.
- First task is Upload data that pulls the dataset from our public S3 bucket. If the table does not yet exist in your Aito instance, it will upload the data in.
- Second task is Label invoices which will read the Google Sheet file row by row, and make a prediction using Aito, and then fill in the results for each row. The filled values are the predicted GL code ("feature"), the confidence, and either FALSE or TRUE if the row needs a manual review, based on the set confidence
Contact: Best way to reach us is through our Slack group. Feeback would be awesome! <3