In this tutorial, we'll show you how to integrate Eden AI's Invoice parser API into your software using Google App Script. With this integration, you'll be able to automate tasks and enhance the functionality of Google services using the power of AI. The same process applies if you want to include other features like : Image tagging, Explicit content detection, Text analysis and many more AI APIs we offer.
Eden AI was created for no-coders having difficulties with choosing the right AI provider and/or integrating several APIs. Managing multiple accounts for each app can be a tough job, but with Eden AI, you can connect and manage all your APIs on a single account. Since some AI providers can be complex to use, we wanted to simplify the “no code” part and make AI available to as many people as possible.
Eden AI allows you to solve multiple AI tasks on Google App Script:
Just like Receipt and Resume Parsing, Invoice Parsing is a tool powered by OCR to extract and digitalize meaningful data, Computer Vision to identify structure of the document, and NLP techniques to pin down the fields. Invoice parser technology extracts key information from an invoice (.pdf, .png or .jpg format) such as the invoice ID, total amount due, invoice date, customer name, etc.
Invoice parser APIs help ensure data accuracy by avoiding errors that can occur during manual data extraction. Then, this information can be used for a variety of purposes and makes it easier to generate reports or export data to other applications and is often used in conjunction with other business management applications.
The first step is to initialize the invoice_parser function that will handle the API call to Eden AI. This function will take 4 arguments: api_key, providers, file, and language.
The api_key is the API key you obtained from Eden AI platform, providers is the name of the provider you want to use to extract the invoice data , file is the invoice file you want to extract data from, and language is the language of the invoice.
Next, use the FormData library to create the payload for the API request:
The payload contains information about the invoice file and the desired response format. You’ll need to append the providers, response_as_dict, file, and language to the payload. The response_as_dict parameter is set to false so that the response is returned as a JSON string rather than a dictionary.
Next, create the header for the API request. The header includes the Authorization and Content-Type parameters.
The Authorization parameter is set to the Bearer Token obtained from Eden AI's platform, and the Content-Type parameter is set to multipart/form-data with the boundary value set to the boundary string obtained from the form data.
Now, use the UrlFetchApp library available in the Google App Script standard library to make the API call to Eden AI. You’ll need to set the method to POST, the headers to the header we just created, the payload to the payload we created in step 2, and muteHttpExceptions to true.
Finally, the extracted data is accessed using the response_json object. In this case, the Logger.log method is used to print the extracted data in the log. However, you can access and use the extracted data in any way you wish, for instance, to create a Google Sheet with the data.
You’re done! 🥳
If you have questions regarding this tutorial, the Eden AI community can help you out on Discord.
Note: The above code is just an example of how to use the invoice parser API from Eden AI.
The specific fields and data that the API returns may vary based on the type of document being parsed and the provider being used.
For more information, check out the full documentation for the invoice parser API.
If you're interesting in more low-code tools, have a look at our step-by-step tutorials on how to bring AI to your application with Power Apps, Retool, Make, IFTTT, n8n, Bubble, Dataiku, and Zapier.
You can directly start building now. If you have any questions, feel free to schedule a call with us!
Get startedContact sales