Convert String data into column and write into Data table

Hi all,

So I have a string having this kind of data

Ram K Singh 99084544 00-00989878
Satish Kumar 562459504 00-00989879
Manoj P Rajan 562459504 00-00989880

I have to write this data into excel. In my excel there are 3 column
Name Lob-Id Location-Id

Like first row will insert like in
Name Column - Ram K Singh
Lob-Id - 99084544
Location Id - 00-00989880

In my sequence I am trying to use Add data row in my datatable, but struggling to add row wise data from the string and put them into their respective column.

Help , Thanks in advance !!

1 Like

Hi @pushhky,

You can get the first field with regex. Use without numbers.

You can split and shoot the second and third fields according to the blank.

Regards,
MY

1 Like

refer to this
d.xaml (10.8 KB)

steps

  1. read file to txt (string variable) (file =
    Ram K Singh 99084544 00-00989878
    Satish Kumar 562459504 00-00989879
    Manoj P Rajan 562459504 00-00989880)
    image

  2. loop over each line of txt
    a) use regex to assign Name/Lob-id/Location-id to newRow (datarow variable)
    b) add newRow to datatable

result
image

1 Like

Ya, you are right, thanks for the suggestion, I will work on it.
Thanks for the quick response.

This is the exact solution I am looking for, I tried somehow same but stuck while implementing regex, you save my so much time. Thanks mate for quick response, really appreciate the efforts.

1 Like

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