How to extract all values from multiple of the same variable in PDF or Text File

Hi all, I am currently working with an invoice template to extract information from the PDF file. I have also been trying to extract this information from a text file which was converted from the PDF. In the example below, there are multiple tables of payments for each invoice given by the client. Each invoice could have just one or many such tables. I would like to extract all the “Amount Payable” amounts from all such tables. Please let me know how I can do this via text file if possible.

image

Hi @anonymous3

Try using anchor base activity or read all the data in the text file and use regex to fetch amount.

Hi @prasath_S ,

I have tried the methods but it only returns the first amount. I want the activity/code to retrieve the amounts for me regardless of how many tables there are.

Have you tried read all the values using read text file activity and use generate datatable activity to convert string to datatable

Use regular expression to get Amount payable ==> amount value

Hi @shaik_Azam ,

it only gets the first amount payable for me. Could you share a code that lets me get all the amounts?

Regards
non

could you please send the text file.

Hi

Not sure if you git your answer, Looks like you are thinking of extracting all amount payable which are present in text file. There are lot of ways, but I would suggest following.

->use Read Text file activity and store the text in a string variable
->use Generate data table activity to convert the text into data table
->using option to do the formatting of columns etc
->Use Write range to feed the data into excel

Once done you will have a column called amount payable, which you can use.

Sample wf is attched, let me know if this was not your goal.
Main.xaml (11.7 KB)

Hi @anonymous3

First Use Read PDF to text activity and set Preserve format to True.

Write the output from the previous step to text file and share it with us.

Hi, this is a sample text file.

@sandeep.tech2009 unfortunately there any other tables and lines in the same document as the tables I’ve mentioned above so your method does not work.

I would like to extract every payment amount at once in order.

text.txt (851 Bytes)

Okay, Did you try using regular expression?

Create this workflow for you : CommunityRegEx.xaml (7.8 KB)

Please let me know if that is what you wanted. In case you have multiple text files like these , you need to just nest the For loop for all the directory files.

Thanks!

Thank you for sending a sample workflow for me. Apologies but I can’t access it at the moment. Is it possible to request screenshots of the workflow from you instead?

Regards,
non

Hi @anonymous3 ,

Do you want me to mail the workflow, Screen shot is attached for your reference:->

Thanks!

Hi, its alright! Thank you so much for your help, I managed to solve my problem with this!

1 Like