I met a problem that I have a datatable with some columnnames that there’re newline inside of it, and I couldn’t assign the value like below example:
If the ColumnName is “First Name”, and it stored in my Excel file will look like below in one cell:
when trying assign
ColumnName) = “Value”
it got an error apparently there is no specific column existed since I used it the wrong way.
I also tried like:
DataRow(“First” + vbcrlf + “Name”) = “Value”
and obviously it’s wrong.
Could anyone give me some advice how to deal with it?
Welcome to uipath forum
Instead of ColumnName you can try with column index as well
Say like this
Datarow(0) - first column
Datarow(1) - second column
Columnindex usually starts from 0 for first column
So you can mention accordingly
If you know index number of the column, can you try the following expression, for now?
We can know which character should be used from the output.
We could Change the Column Names as Required and then access the values using the Proper Column Names. For Instance, Trimming the Column Names can be done as provided in the Post below :
lets assume you have a datable in place with the columnnames having the beginning ending spaces.
so with a for each you can do name correction as following
item.Columnname = itemColumnname.trim()
Dont forget to configure the typeargument of the for each to the datatype Datacolumn
However, In your case along with Trimming, we would need to Remove New Lines with a Space.
we could try with the Following Expression :
item.ColumnName = item.ColumnName.ToString.Replace(Environment.NewLine," ").Trim
Let us know if it doesn’t work. We may need to use Regex to Replace NewLines