Hope you doing good I have excel file and I need to remove extra whitespace from each value can you please help me with linq query.
You can use like this:
This will removes the white spaces
Try below expression in Invoke Code activity to do that.
InputDT.AsEnumerable().ToList().ForEach(Sub(row) row(“ColumnName”) = row("ColumnName").ToString.Trim)
Note: Create one argument for Invoke Code activity and mention properties as below.
Name - InputDT
Direction - In
Type - DataTable
Value - InputDT
could you please explain this query
I need to remove whitesapce and return it into datatable so that I can use that for my next action.
have a view on this:
Say your original DT is dtData. Take a clone of it say dtCorrected in an LHS of Assign and in the RHS try with below query
(From r in dtData.AsEnumerable
Let ra = r.itemArray.select(Function (x) x.toString.Trim.Replace(" “,”")).ToArray
Above query helps you remove all extra white spaces and write data back to the DataTable. Replace ColumnName with actual column the one you want to remove spaces.