Using delimitors and new lines to split a txt file

Hi all, I import the below from a txt.file in to Ui Path

ID|Name|Occupation
101|xx|job a
102|hh|job b
103|jj|job c
104|oo|job d
105|ii|job e

My goal is to split it all using the | and then export the result in to an Excel file so each value is in it’s own cell (ID in cell A1, Name in B1, Occupation in B3, 101 in A4 etc). All for learning purposes.

I believe I can use split.(Var, Environment.newline) and then split.(Var, “|”) to split each line up.

Is there a way I can combine both these functions in to one string? I’m then struggling to get the new data in to some sort of string array so I can then export it to an Excel file (or datatable etc)

Would I have to use a ‘For Each’ or can I do it all in ‘Assign’ activities?

A few different learns for me here! Thanks for any help in advance,

Jordan

DataTable.xlsx (8.7 KB) TextData_To_DataTable.xaml (4.8 KB)

I have used this method.

1 Like

Thanks Parul, your xmal works really well and is an easy way of achieving my goal :slight_smile:

1 Like