I have two inputs:
a- folder contains multiple text files
b- excel file
I want to develop a process that import a) and do a loop through the folder, so it could read the text files. Then extract the specific information from each text file. After it has to compare the extracted information to the excel file values b).
Hope the below steps would help you resolve this
Use a assign activity like this
arr_files = Directory.GetFiles(“your folderpath”)
Where arr_files is a variable of type array of string
Now use a BUILD DATATABLE activity and create a table structure u want which can be used to compare with the excel file u have and get the output as dt-input
Now use read range activity and read that excel file with datatable output named as dt
Use a FOR EACH activity and pass the array variable as input and change the type argument as string
Inside the loop use a READ TEXT FILE activity and pass the input filepath as item and get the output as stroutput
From this string output get the information u want and add it to the datatable built earlier with ADD DATAROW activity
Now you can compare the datatable read and built by ur own however u want
Have a view on this tutorial on how to use datatable
Datatable - variable type is the most commonly used variable type by all UiPath users
And it’s been the most often asked queries in forum especially on its manipulation
So I would like to have this post as a repository for those who are looking for expressions related to Datatable
Let’s go one by one keeping dt as name of datatable variable
1. Get number of rows in a datatable dt
dt.Rows.Count (output - int32 type)
2. Get number of columns in a datatable dt
@Palaniyappan thank you for replying, I’ll tryy what you suggest but I woonder how can I get the inormation I want from the text file??
You can use the Matches activity that requires RegEx. Using that you can select whatever information you want!
Good Automations, Cheers!
It depends on the text and it’s format
There are n number of ways to extract the specific set of information u any
String manipulation methods
Choose the one which suits best to ur requirement