Editing Values in Column of DataTable

I am hoping to be able to go through one column of a DataTable and for each row in that column…

  1. get the value from that row
  2. get a substring of that value by trimming from the start and end of that value
  3. put my newly trimmed value back into place in the data table
  4. move on to the next row in that column

I feel as though this should be possible. Is it? Hopefully this makes sense

Hi @jpreziuso

Did u need the substring of cell.value ?

Yes…for an entire column. But I don’t want to pull them out of the DataTable…I still want to use the DataTable. I just want to take the substring of a cell value and then replace the current value with that substring

in basic it xould be done with this essentials

leftside: row(YourCoumnNameOrIndex)
rigthside = row(YourCoumnNameOrIndex).toString.trim

e.g. row(“Col1”) or row(0)


I see, that makes sense. The problem I am experiencing now is that column is apparently “read only”. This DataTable is the direct result of executing a query so I am not sure how to fix the read only problem. Do you have any idea?

lets assume that we arw talking about a datatable variable as usually we do use here in UiPath World.

Give a try on following before each row activity
left: yourDatatableVar.Columns(IndexOrName).ReadOnly
right: false

1 Like

That seems to have helped! Last question, instead of just using trim, how do I just trim the first 4 characters and the last 4 characters? I am using Left and Right substring but it is not working correctly. Do you know how to do that?

maybe this samples do help
we reduced the length by 4 as want to cutoff the first and the last 2 chars

1 Like