/
Extract from Invoices and Export data to Excel

Extract from Invoices and Export data to Excel

Home | Categories | How-to-Articles | Command Reference | Examples | Troubleshooting | Cognillo.com

Use this page to find example workflows for Genta Automation.


Script

In this example, you have multiple invoices from different vendors. Each invoice is different and have different structures.

You will use Gentato loop through the invoices in a folder, and extract the invoice data into a datatable, then export all the data collected to Excel.

Create Datatable $InvoiceData Add Datatable Columns "Document Type","Company Name","Invoice Number","PO Number","Total Amount","Tax Amount","Freight Amount","Account Name","Company Address","Invoice Date","Order Date","Delivery Date","Account Number","GST Number","Customer ID" //The folder below is also located in your My Documents\Documents\Digital Workforce\Genta Digital Worker\Assets\ //You could remove the C:\ if you want to use the example data from Genta installer $folder = "C:\Mixed Invoices" foreach ($pdf in $folder) { //By default, Genta will attempt to auto-detect //The -invoice parameter is optional //If -invoice is used, Genta will use Microsoft Form Recognizer to pull additional data from PDFs //Below is without the -invoice and will auto-detect file context, but may retrieve less data Extract from $pdf Extract from $pdf -invoice //Use a Pause command below to view the variable values extracted //You can remove the pause once you have all of the variables you need for completing the below Pause //Click the Resume button to continue //You can remove the Pause to try this again without stopping //You want to now add the values extracted to the datatable switch to $InvoiceData //Next, use 'If' command to check if the invoice is from Acme if ($_CompanyName contains "Acme") { //If it is an Acme invoice, add the relevant details from that invoice //into the datatable Add Datatable Row $_Classification_Name,$_CompanyName,$_InvoiceNumber,$_PurchaseOrder,$_Total,$_Tax,$_Shipping,"NA","NA",$_InvoiceDate,$_OrderDate,$_DeliveryDate,"NA","NA","NA" } if ($_CompanyName contains "Brawn Manufacture") { Add Datatable Row $_Classification_Name,$_CompanyName,$_InvoiceNumber,"NA",$_Total,$_Tax,"NA","NA","NA",$_InvoiceDate,"NA","NA","NA","NA","NA" } } //Below, you can add the datatable result after all rows are added Add Result $InvoiceData //Below, you can send the results to Genta Desktop //Look for "Open Results" button once it is complete Send Results to Genta Desktop

Resources


Related Articles

Filter by label

There are no items with the selected labels at this time.

Related content