I need to fetch a particular data from multiple pdf files using uipath


#1

I need to fetch a particular data(Balance Due) from pdf files and compare the same with a column (Balance due) in excel.

Though the PDF file will be in same format, but positioning of the field Balance due may differ depending on number of invoice lines,etc.

How do i make my bot understand to fetch only that data which is balance Due??
Say my invoice looks like this, and I need to fetch the balance due amount for multiple pdf files:

I am trying the reconcile the pdf data with excel file data.
Fetch balance due amount from PDF and compare it with Excel data file.

Thanks,
Mallika.


#2

@Mallika use read PDF activity to read PDF file and the split obtained text with respect to “Balance Due” and then split array(1) with respect to newline to get ur required text in new array1(0). U may or may not need to do further string manipulation based on your output.


#3

Thanks for the reply.
It would great if you can elaborate and can specify the activities to be used in Uipath.


#4

@Mallika

  1. Read pdf using Read pdf activity and assign output of it to a string variable.(ex.str1).

  2. Split the the string(ex. str1) with respect to “Balance Due” and store the output into array variable(Ex.array1). use assign activity for below operation.

array1=str1.split({“Balance Due”},StringSplitOptions.None)

U can also use RemoveEmptyEntries option in place of None

  1. Split array1(1) with respect to Newline since after splitting with “Balance Due” what ever comes after Balance Due will be stored in 1st position of array. And store it in a new array variable(Ex. array2).
    Use assign activity for below operation.

array2=array1(1).Split({Environment.NewLine},StringSplitOptions.None)

  1. assign array2(0) to your required variable. u may or may not required further processing based on ur output.

Please let me know if u have any doubts.


#5

But when i use Read PDF, i can mention only one specific file name.
How do i handle when i want the same to read multiple invoices file with different file names?


#6

@Mallika u have store the file names in string array then u must use foreach inside it u have to use above functions.


#7

No, i cannot have the list before hand as the naming convention is fixed with time stamp.
So its dynamic and will be created on fly and saved.
This bot has to work on that invoice created at that point and do the reconciliation


#8

@Mallika Use below function to get the files in a folder.

StringArrayvariable[]= Directory.GetFiles(“GIve ur folder path”).

Use For each give this array variable.

Inside for each use try previous things which i said to you.


#9

With context to above , how do i fetch only numbers from a text that has the number as well the text?

Example, I have used screenscsraping , and it has scraped the the balance amount.
However for few cases Due $500.00, for few its CHF28,8,8890.95.

So how do i extract the text only. Note my numbers have decimals and comma.


#10

@Mallika use replace function to replace characters with String.empty