Moving pdf extracted data to excel

hi i’ve extracted the data from pdf using REGEX now i want to paste that data to excel which already has the headers

1 Like


If you have the output from regex as a string variable then there are two ways to write it to a excel

— If the extract string from regex has a proper header and a delimiter that separates each column value with a comma or a space
— Then we can pass that string to GENERATE DATATABLE activity and mention the delimiter and get the output as a DATATABLE

— Once the DATATABLE is ready use a APPEND RANGE activity where pass dt as input so that it gets appended to the existing excel file
But make sure that excel file has same order and number of columns as in the DATATABLE

  1. Second method

If we don’t have a header at all then we need to split the text into individual lines so that we can pass them as a data row

— first create a DATATABLE with BUILD DATATABLE activity with same column structure as in excel

— then if the string is in a variable named strinput
Then use a assign activity like this
Arraylines = Split(Strinput.ToString, Environment.NewLine.ToArray())
Me here Arraylines is a variable of type array of strings

I assume that the each line in that string input has values separated with comma

— now use a FOR EACH activity and pass Arraylines as input and change the type argument as string

— then inside the loop use a Add data row activity and pass input in ARRAYROW as Split(item.ToString, “,”)
And in DATATABLE mention as dt

—now as usual use a append range and pass dt as input

Hope this would help you resolve this

Cheers @lakshmi3

thankyou for the suggestion
what if i want this data to be pushed into the DB directly rather than saving it in the excel how can we do that

1 Like

We can use database activities where we can pass the same DATATABLE as input with INSERT activity

Go to design tab in studio → manage packages → All Packages → search for uipath.Database.Activities

Where we can use insert activity

Cheers @lakshmi3

thannkyou for the suggestion
DB_sequence.xaml (15.4 KB)
i’ve tried the process you suggested but i’ve this issue as i’ve used the build data table and extrcated the regex data from there…i’ve attached my workflow can you suggest where the changes can be done