Hello, I have a question about utilizing the Regex method to extract PDF data into Excel.
I have a flow to extraction that I built (see attch main.xaml), however all of the data I’ve extracted so far is accurate, but in item number, it has only been recorded in a single line. extract.xlsx (8.8 KB)
The item number is expected to be able to collect all the data in the next row, as shown below.
As per the flow you are extracting the item only once and even if gets multiple matches you are using first result
you should be using matches output to get all matches and also for each match you need to add a data row for that you can use a loop to get more rows again
Results will give multiple matches and first match as the name suggests will give only the first match…that is the reason you get the item Id only once
Hmm…in regexr, for this regex already capture all the data (seven matches), why is it only one matches that capture and extract to Excel only one line, and what supposed i need to do? thanks Anil.
When you use Find Matching Patterns activity and store the output the datatype of the output will be System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Match>
Use an for each Loop activity to print all the matching values in the excel using activities.
So As per your previous screenshot if you need each row to be populated…not only the itemid but all columns…
then the loop must be on one of the itews which works for the current loop you are using…
apart from that you need to loop other items as well…all are used as first values only…so only first is coming…if you want each row…then use matches(index).value here index is a variable which is created in the for loop properties…if you open properties you will see a index
but again…few rows dont have values…you should manage them as well
You have created the output variable in first match. So it’s printing only first match value. Create the variable in Result. It will print all the matching values. Hope it helps!!
For every Regex expression you create an variable you need to run an For each loop for every expression.
Intialize an count variable and initialize to 1
In the for each activity increment the counter by 1.
Use Write cell Workbook activity and specify the cell + countervariable.toString