Excel split one column to two separeted by ";"

Hi,

How can I split column in Excel file if data that should be stored in two columns presents in one column and separted by ";“Split Excel
Sequence of my process is on the pic, but it shows error on: row.split(”;"c)
Am I on right way or there are other solutions?

You need to specify the specific column you are wishing to split. So it should be row.item("ColumnName").ToString or row.item(ColumnIndex).ToString rather than just row.

I am assuming VarRow is a string array variable, correct? Because string.split will return an array of strings.

If your end goal is to split data from one column into 2, does the 2nd column exist and is blank? Or do you need to add a new column? It looks like that portion is missing from the code you have pictured as well

If the spreadsheet is excel, you can do it right in excel with Text to Columns feature


image
image

1 Like

@Dave

Hi Dave,

Thank you for you responce, I follwed your advise and used row.item(ColumnIndex).ToString


But I am getting error:
Assign: Column ‘A1’ does not belong to table DataTable.

datatable index have to be integers. output datatable activity then write output so you can see what datatable looks like.

“A1” in an excel sheet would be the first column and the first row in your datatable. The Index for datatables starts at 0, so it would be row 0, column 0 in your datatable. so you can change it to be row.item(0).tostring, which will get the first column in every row in your for each loop. If you only wanted a single row, then remove the for each loop and change it to be DTcsv.rows(0).item(0).tostring

Anytime you see the word ‘index’ in programming it is always referring to an integer

2 Likes