How To Read row and column in text file

Hello,
I have 3 text file in a folder (but it can change). All files have column and rows (different size). Columns are break up with the “|” symbol. I have 2 problems.

1st one is; I want to read 3rd row 1st column in the all text files.
2nd one is; I want to read all 10th column in the all text files but it should start 2nd row.

Could you help me?

1 Like

Welcome @Muhammet_Duzparmak to Forum,
1.First convert the string present in txt file to data table using generate data table activity.
2.save to excel then you can easily access the values according to your requirement.
Cheers
Vashisht.

1 Like

thank you very much i did :slight_smile:

Hi
Welcome to uipath community
Hope this steps could help you resolve this
—use a assign activity and mention like this
Out_Filepatharray = Directory.GetFiles(“yourfolderpath”,”*.txt”)
This will give us a array of file path of text files in a folder and doesn’t matter with the number of files
Where Out_Filepatharray is a variable of type array string
— use a for each loop and pass the above variable as input and change the type argument as string in the property panel of for each loop
— inside the for each loop use a read text file activity and pass the file path input as item as that is the variable that holds the file path of text file in that folder
—and get the output from the read text file activity as a variable of type string
—use generate datatable activity and pass the above variable as input and get the output as a variable of type datatable named outdt
— next to this generate datatable activity use a assign activity to get the 3rd row and 1st column mention as
Out_value1 = outdt.Rows(2)(0).ToString
And to read the 10th column and second row
Out_value2 = outdt.Rows(1)(9).ToString

— next to these assign activities use a clear datatable activity and mention the input datatable as outdt

Cheers

3 Likes

Bro if it solved the problem mark it as solution and close the thread…
Any issues ping me bro
Cheers
Vashisht.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.