UiPath Activities

The UiPath Activities Guide

Document Processing using Intelligent OCR

The example below explains how to use the Intelligent OCR package and integrate it into the UiPath workflow. The files are gathered, classified, processed and validated. Once all steps are confirmed, an .xlsx file is created, including the final output. It presents activities such as Validate Document, IntelligentOCR Scope, Get Field, Get Table, Process Document, and Classify Document. You can find these activities in the UiPath.IntelligentOCR.Activities package.

This is how the automation process can be built:

  1. Open Studio and create a new Process named by default Main.
  2. Drag a Sequence container in the Workflow Designer and create the following variable:
Variable Name
Variable Type
Default Value

filePaths

System.String[]

-

data

DataTable

-

i

int32

-

table

DataTable

-

  1. Drag an Assign activity in the sequence container.
    • Add the variable filePaths in the To field and the expression .directory.GetFiles(in_ImagesFolderPath) in the Value field.
  2. Add a Build Data Table activity under the Assign activity.
    • In the Properties panel, add the variable data in the DataTable field.
    • Click on the DataTable button to define your table columns.
    • Click on the Add Column button. In the new window, add the name of the column in the Column Name field.
    • Select the String value from the Data Type drop-down list.
    • Select the check box for the Allow Null option. This allows null values to be added in this column.
    • Once all columns are added, select the OK button to close the window.
    • For this example, we have used the following columns:
Column Name
Data Type

FileName

String

Classification

String

Company Name

String

Customer Number

String

Email

String

Date

String

Delivery Address

String

Billing Address

String

Invoice Number

String

Total CHF

String

  1. Drag a For Each activity below the Build Data Table activity.
    • Add the name file in the Item field.
    • In the Properties panel, add the variable filePaths in the Values field and the variable i in the Index field.
    • Select the String option from the TypeArgument drop-down list.
  2. Add an IntelligentOCR Scope activity in the body of the For Each activity.
    • Select the Do sequence from the activity's body and create the following variable:
Variable Name
Variable Type
Default Value

classification

String

-

document

UiPath.IntelligentOCR.FC.FCDocument

-

field

UiPath.IntelligentOCR.FC.FCField

-

  1. Drag an Add Data Row activity inside the Do container.
    • In the Properties panel, add the expression {} in the ArrayRow field and the variable data in the DataTable field.
  2. Place an Assign activity below the Add Data Row activity.
    • Add the expression data.Rows(i)("FileName") in the To field and the name file in the Value field.
  3. Drag a Classify Document under the Assign activity.
    • Insert the expression {in_FCDotFilePath} in the DefinitionFiles field.
    • Add the value file in the SourceDocument field.
    • Add the variable classification in the Result field.
  4. Drag an Assign activity.
    • Add the expression data.Rows(i)("Classification") in the To field and the variable classification in the Value field.
  5. Place a Process Document activity under the Assign activity.
    • Add the expression {in_FCDotFilePath} in the DefinitionFiles field.
    • Add the value file in the Document field.
    • Add the variable document in the Result field.
  6. Place a Validate Document activity under the Process Document activity.
    • Add the variable document in the Document field.
    • Add the variable document in the Result field.
  7. Drag a Sequence container and name it Company Name.
  8. Drag a Get Field activity inside the Company Name sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "CompanyName" in the Name field.
    • Add the variable field in the Result field.
  9. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Company Name") in the To field and the expression field.Value in the Value field.
  10. Return to the Do container and drag a new Sequence activity under the Company Name container.
    • Name the new sequence Customer Number.
  11. Drag a Get Field activity inside the Customer Number sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "CustomerNumber" in the Name field.
    • Add the variable field in the Result field.
  12. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Customer Number") in the To field and the expression field.Value in the Value field.
  13. Return to the Do container and drag a new Sequence activity under the Customer Number container.
    • Name the new sequence Email.
  14. Drag a Get Field activity inside the Email sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "Email" in the Name field.
    • Add the variable field in the Result field.
  15. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Email") in the To field and the expression field.Value in the Value field.
  16. Return to the Do container and drag a new Sequence activity under the Email container.
    • Name the new sequence Date.
  17. Drag a Get Field activity inside the Date sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "Date" in the Name field.
    • Add the variable field in the Result field.
  18. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Date") in the To field and the expression field.Value in the Value field.
  19. Return to the Do container and drag a new Sequence activity under the Date container.
    • Name the new sequence Delivery Address.
  20. Drag a Get Field activity inside the Delivery Address sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "DeliveryAddress" in the Name field.
    • Add the variable field in the Result field.
  21. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Delivery Address") in the To field and the expression field.Value in the Value field.
  22. Return to the Do container and drag a new Sequence activity under the Delivery Address container.
    • Name the new sequence Billing Address.
  23. Drag a Get Field activity inside the Billing Address sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "BillingAddress" in the Name field.
    • Add the variable field in the Result field.
  24. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Billing Address") in the To field and the expression field.Value in the Value field.
  25. Return to the Do container and drag a new Sequence activity under the Billing Address container.
    • Name the new sequence Invoice Number.
  26. Drag a Get Field activity inside the Invoice Number sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "InvoiceNumber" in the Name field.
    • Add the variable field in the Result field.
  27. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Invoice Number") in the To field and the expression field.Value in the Value field.
  28. Return to the Do container and drag a new Sequence activity under the Invoice Number container.
    • Name the new sequence Total CHF.
  29. Drag a Get Field activity inside the Total CHF sequence.
    • In the Properties panel, add the variable document in the Document field.
    • Add the expression "TotalCHF" in the Name field.
    • Add the variable field in the Result field.
  30. Drag an Assign activity under the Get Field activity.
    • Add the value data.Rows(i)("Total CHF") in the To field and the expression field.Value in the Value field.
  31. Return to the main Sequence container.
  32. Drag an Excel Write Range activity under the For each activity.
    • In the Properties panel, add the value "Sheet1" in the SheetName field.
    • Add the value "A1" in the StartingCell field.
    • Add the variable data in the DataTable field.
    • Add the expression "OCR_Results.xlsx" in the WorkbookPath field.
    • Select the AddHeaders check box for considering the first row of the table a header.
  33. Drag an IntelligentOCR Scope activity below the Write Range activity and create the following variable:
Variable Name
Variable Type
Default Value

doc

UiPath.IntelligentOCR.FC.FCDocument

-

  1. Place a Process Document activity inside the Do container of the IntelligentOCR Scope activity.
    • Add the expression {in_FCDotFilePath} in the DefinitionFiles field.
    • Add the expression filePaths(0) in the Document field.
    • Add the variable doc in the Result field.
  2. Drag a Get Table activity under the Process Document activity.
    • Add the variable doc in the Document field.
    • Add the expression "LineItems" in the Name field.
    • Add the variable table in the Result field.
  3. Drag a Write Range activity under the IntelligentOCR Scope activity.
    • In the Properties panel, add the value "Table Example" in the SheetName field.
    • Add the value "A1" in the StartingCell field.
    • Add the variable table in the DataTable field.
    • Add the path "OCR_Results.xlsx" in the WorkbookPath field.
    • Select the AddHeaders check box for considering the first row of the table a header.
  4. Run the process. The automation process creates a new workbook with all classified, processed and validated data.
     
     
    Download example

Updated 6 months ago


Document Processing using Intelligent OCR


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.