Specific Data from PDF sheet

Hello Team,

Hope you are doing good, I came across one new scenario (in PDF) and finding it little complicated to get the solution. Below is the scenario:

I am trying to extract the number which is in the format like 2343…-23-2 (n number-2 digit-1 digit) from PDF sheet, can you please advise how it is possible to extract all this number which are in the above mentioned format from the PDF sheet which is having multiple pages. Please guide me the process.

Looking forward to hearing from you.

Regards,
Rahul

@Rahulsinha Please check below regex method and it gives output as collections.

 System.Text.RegularExpressions.Regex.Matches(str,"[\d]+-[\d]{2}-[\d]{1}")

where str is your input string variable

Hi Manju,

Thank you, can you please let me know from initially, how to proceed with this. I mean like starting from the sequence how to make it possible

Hi @Rahulsinha

Use ismatch activity and pass the str variable and give the pattern as mentioned by @Manjuts90 and pass the result

Thanks
Ashwin.S

Thanks A lot Ashwin, Could you be kind enough to let me know from the starting like how to do it
Adding read PDF text in the sequence then what next i should do, i mean how to proceed

@Rahulsinha In your case you can use 2 ways either using matches activity with below regex pattern

or
use below code in for each

like below

image

Each time loop runs item.ToString prints new value.

Regarding regex pattern.

Here [\d] matches any digit between 0 to 9
[\d]+ matches 1 or more digits
followed by -
[\d]{2} matches exactly 2 digits
followed by -
[\d]{1} matches exactly 1 digit.

if you still have doubts contact me and check about regex in google once.

Above error I am getting while doing it for each
Please advise if I am doing it wrong

@Rahulsinha Can you upload your code here if u don’t mind?

I dint get you.
Code like?

@Rahulsinha xaml file bro

Its all PDF file bro I cant share :frowning:

I want all that number(format which i told earlier in our conversation) to be extracted in an excel sheet from PDF file that is what i am trying to do bro

@Rahulsinha please check the variable read pdf text and in for each. Change also arguement type to object

if above options will not work change arguement type to System.Text.RegularExpressions.Match and change.

Hi Buddy,

Still the same error, could you please elaborate from the starting, what Activities I need to add, what variable should I create, etc (from initial point). below is an example of what I am trying to extract in an excel sheet.

@Rahulsinha did you create a string variable which is assigned to output of read PDF text activity and same variable is used in matches method?

Check the argument type of for each to object.

If argument type object gives any error then Change argument type to System.Text.RegularExpressions.Match and check

Please check the above screenshot and advise, IF i am missing something. I am unable to process :frowning:

@Rahulsinha In values field use below regex expression and keep arguement type as object.

Still Unable buddy to process, getting the error. If you dont mind can you please elaborate from starting I mean I put Read PDF text what variable do I need to create then putting For Each what I need to do.
after that do I need to put Build Data Table , Add Data Row and Write Range to extract the details in PDF, What all variable do I need to create.

Regards,
Rahul

@Rahulsinha Please check below xaml file usage of matches and getting output from it.

Test.xaml (9.2 KB).

For write range activity you required datatable variable. Please check datatable manipulation videos in Uipath academy.

Hi @Rahulsinha,

Please have a look on the screenshot. Hope it will help you.

Please check whether you have ‘System.Regex’ package or not. If not please install the package from ‘Package Manager’. And if you have scanned pdf then please use ‘Read PDF with OCR’ activity to read the pdf.

Thanks & Regards,
Apurba

@Manjuts90 this works :slight_smile:
But only the issue here is I can see all the data in Output, how can I extract those details in an excel sheet.

image