Cannot Scrape PDF Data into Excel

I am trying to use UiPath for the first time In order to scrape a PDF and put the text into excel. I cannot upload my work since I am a new user but I started with ‘Read Pdf text’ > ‘write text file’ > ‘matches’ > ‘build data table’ > ‘add table row’ > and lastly the excel activity.

I am getting errors on the Matches section when I try to set a variable in the ‘Result’ part of the properties. This variable gets referenced in the input of the ‘add data row’ so its necessary to have.

I get a long error when I create a variable and then try to reference it. When I do Set Var or Set Variable, it cannot create a new variable and says it expects an expression

Hi @Dylan_Foley ,

Please find the below with detailed explanation

Hi @Dylan_Foley,

Have you tried using document understanding.Another method is to read PDF full and pull specific fields using split and regex.

Regards,
MY

Hello @Dylan_Foley

As you are using Matches i think you have prefered the Regex method.

Then what you can do is:

1)Directory.GetFiles(“Folderpath”) This will give the list of files
2)use a for each loop and loop through each file
3)Use Read PDF Text activity and get the result to a string variable suppose its: strout
4)either you can use assign activity with regex expressions to fetch the value or you can use matches. If you are using matches you will get output as “IEnumerable” datatype.
Either you can loop or using the index you can get the value.

Another approach is:
1)Opening the pdf in pdf reader
2)Get text activity to get the data

ANother approach is:
Using the document understanding either using predefined models or you can write your ML model.

@Dylan_Foley

Did you pass a regular expression in the matches activity. Also, if possible post here what is the data that you want to extract