Hi, I am extracting data from a website regularly, and saving it to a data table. Sometimes the data in one or more columns will have multiple rows/lines in a cell, like this:
ABCD
1234
5678
How can I delete one or two of these rows and keep the third? (or delete two and keep one for that matter)
If you need the last line always then use for loop to iterate over the rows of the column
And then use assign inside currentrow("ColumnName") = currentrow("ColumnName").ToString.Trim.Split({Environment.NewLine},Stringsplitoptions l.None).Last
In invoke code activity, use the below code by keeping dt as in/out argument:
For Each row As DataRow In dt.Rows
If row("ColumnName").tostring.Split(environment.NewLine.ToCharArray).Count>1 Then
row("ColumnName")=row("ColumnName").tostring.Split(environment.NewLine.ToCharArray).last.tostring
End If
Next