Read text file and write into appropriate column in excel sheet

Hi guys,

I have data in a text file in below format:

Is there any way in which I can read this data and write them in appropriate column names: FirstName, LastName,Phone?

I got following error on trying to split the string at ‘|’


Santa Krish

@Santa_Krish The split function gives output of a one dimension array. Please change the datatype of strSpit to Array[string]. This will resolve the error.

1 Like

Hi @Santa_Krish

you can read the data by using read text file.

split the readable data by using |. for example (Array=sample.split(“|”,c))

Assign variable Array should be one dimension array.

write your value like array(0).tostring, array(1).tostring, array(2).tostring. in the appropriate column name.


1 Like

did you use Generate DataTable activity?

1 Like

This sample workflow can help you to do the same. Just check and let me know.

StringOperation.xaml (4.7 KB)


Thanks Sugumar, It works like a charm :slight_smile: . Btw can I know the function of NewLine separator property in Generate Data table activity? Is it used to end the current row and fetch next row?

No @Pradeep_Shiv, I was not familiar with this activity before your comment. On googling, found how it can deal with data. Thanks for your help!

1 Like

cheers @Santa_Krish

Hi Krish,
You can use ‘|’ as a delimiter. I think you know about CSV, CSV stands for Comma Separated Values. So, when you change your text file to CSV, it uses a comma as a separator. In the same way, you can use ‘|’.
Please refer the attached.---------> StringProcess.xaml (4.7 KB)

1 Like

Thanks a lot Sahil!!

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