Split string in DataTable

Hello again,

I need little assistance from you fellows.
In the first part of task, I had some issues, but i resolved that with @JGuarino (thank you buddy so much),
but in second task i have new issues. What is the problem:In Excel file I have values in column D
( HGF12 TrueSmart Party)
( HGF13 TrueSmart Party)
( HGF14 TrueSmart Party)
( HGF15 TrueSmart Party)
In For each Row I have :
“str_SplitString” is array of string, I need one variable for (HGF12), and second variable for (TrueSmart Party), and variable_1 I want be written in column C, and variable_2 stays in column D.
How can I do that?

Thank you so much…


You just assign the first variable to row(“Column C”) and second variable to row(“Column D”) inside the for each row and that value will be display as you expected.

row(“Column c”) = Variable 1
row(“Column D”) = Variable 2

You can create one new Data Table using Build Data table and for each row once you use split you can use AddDataRow and pass the arguments with the index of str_SplitString. abd then you can write the Data table to excel.

I want this strings “HGF12 TrueSmart Party” split on two string, i do next syntax in For each row:
str_SplitString=Split(row(“Description”).ToString, " ")


When I assign str_Desc variable and start the Robot, i have error (Assign: Index was outside the bounds of the array.), but in output panel he just cuts middle part (TrueSmart), and i don’t need that, i need ( TrueSmart Party)
I need help how to assign str_Desc variable, and how to store str_CCode in same DT but in new column.

str_SplitString=Split(row(“Description”).ToString, " ") is splitting on all spaces. So the result is an array with 3 elements. That is the reason why str_Desc=str_SplitString(1) is TrueSmat and NOT TrueSmart Party

A split logic based on

  • RegEx (detect HGFXX and the rest)
  • or based on Substring length

could be a working approach option for you


row(“Column C”) = str_SplitString(0)
row(“Column D”) = str_SplitString(1) + " " + str_SplitString(2)

Or Replace the CCode with an empty space so it will still work even you got more words after the Code.

See Test002.zip (21.6 KB)

@JGuarino @ppr Thank you guys, is done

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