How to convert the text file data to datatable or excel file?

Hi all,

I have a text files which contains name, ph and Age of some persons . i have to read the text file and paste those details to the excel in the defined format. I’m facing issues in adding those details in the particular format. I will attach down the sample input and output . Kindly help me out.



Hello @Akash_Clv

You can check the below video to convert text to Datatable. Once you convert to datatable you can try transpose or datamanipulation from datatable to get the required data.


1 Like

Hi @Rahul_Unnikrishnan

It doesn’t work in my case, Bcoz my input has values like Key and value.All names in the text file should be in the name column and same for the age as well.

For ex

(input format) → String
Name Akash
Age 23

Name Ajay
Age 45

Name Vijay
Age 35

(output format) — Data table
Name Age
Akash 23
Arun 45
Vijay 35

I need output in this format , Kindly look in to this .

thanks in advance

can you try using generate datatable activity which converts string to Datatable

1 Like

hi @Shiva_Nikhil

i Have tried it and the output is not as expected


Read Text File into a string variable.

Split on VbCrLf + VbCrLf (basically split on every blank line)

Now you have an array of the records. Then you can For Each through the array and split each one on VbCrLf. Using Add Data Row, your array(0) will be Name and array(1) will be Age. You can just use Replace to get rid of "Name " and "Age " each time.

1 Like

Can you share any example input string format i will try my end once to help you better
Thanks and regards

1 Like

hi @Shiva_Nikhil

i have attached the img kindly look into it .

input String

Output Datatable

hi @postwick

It Sounds good , but can you share me xaml for better understanding .

Thanks in Advance

Hi @postwick

Thanks for your answer, i have resolved the issue using your idea .

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