How do I write Data from text file to Excel?

Hi guys,
How do I write Data from Text file to Excel?

Best regards,
Lwin Moe Aung


Follow the Steps :slight_smile:

  1. Build Data Table
  2. Read data from Text file and manuplate the lines and add them to Data Row.
  3. At the end using write range, Write that DT to excel file.
1 Like

Thanks for your reply.
I will try it.:grinning:

Could you provide source code?Thanks


That will be based on input file. You just provide me sample input i will write workflow for the same.


attempt first, if you get stuck ask help :slight_smile:

1 Like


Is it ok for sample? (183 Bytes)

Thanks for reminding bro but the one who asked the question and me are developing a robot together.So,if I’ve something wrong,I’m sorry.:sweat_smile:

1 Like


Please find the attachment.
Main.xaml (13.7 KB)


I tried this it’s works.if we want datarow with more than 2 columns like name value place then how add datarow - {item.split("“c).first,item.split(”"c).last} will be coded.can u guide us.


Thank you very much.:laughing:

1 Like

Split is a function from which i can split a string and make it into array of string, from which i can get the data through index

Example : If you see text file it has data like aa 5 as follow

So , If you see the code first, what i did is

  1. First build the DataTable by using Build DataTable activity.
  2. Read the text file line by line. Then, save it into array of string
  3. Iterate through string using for-each loop.
  4. and then using add data row i am adding the data into DataTable.

item.split(" "c).first means :

Item = aa 5
Split(" "c) = it will split item through space and add it into array so now
" aa , 5" is value
c = ToCharArray

.first = First index of array
.last = Last index of array

and if you want something from 2 , 3 , 4 … index in this case: You can write like this item.split(" "c)(2)

example : aa 5 name xyz phone 234
and you want xyz so, you gonna write : item.split(" "c)(3)


How can I write this text file into excel?
Please help…Thanks
test2.7z (438 Bytes)

Hi @111125,

Please check the following Robot.
If you need further advice, don’t hesitate to drop message

Have a nice dayForum 001.7z (18.4 KB)

Thanks a lot !!
But I need to separate each data into each cell
Not all data in a cell…


What do you mean?
Do you have the result file that you expected? I need it to understand your requirement

SKlist.xlsx (11.1 KB)
Like this file


I think you can use this excel formula to split your column (not necessary using robot).
Once you confirm the result is correct (splitting text base on number of character) then we can proceed to design the robot to run the macro and produce this file.

Thank you

Result.xlsx (13.5 KB)