Remove a character in column

Hi Team,

I have an excel file.
image
Its just an example. In real time there are thousands or such rows.
I want to remove the / character using the linq query.
Any help is appreciated.
Thanks!

Hi @satish_kumar

  1. Use the “Read Range” activity to read the Excel data into a DataTable and store it in a variable, let’s say “excelData.”

  2. Use an Assign activity to modify the data in the “excelData” DataTable:

excelData= excelData.AsEnumerable().ToList().ForEach(Sub(row) row("ColumnName") = row("ColumnName").ToString().Replace("/", ""))

Replace “ColumnName” with the actual name of the column from which you want to remove the ‘/’ character.

  1. Use the “Write Range” activity to write the modified “excelData” DataTable back to the Excel file, overwriting the existing data if necessary.

Hope it helps!!

Hi
It says that we cant use assign operator
can you please give step by step process and the datatype of the variables.
Thanks!

@satish_kumar

excelData will be Data Table Variable i.e System.Data.DataTable.

Regards,

should i be using = operator in assign activity?
Its showing an error.

@satish_kumar

You can try it with invoke code

Check the below workflow
linq.zip (2.9 KB)

cheers

@satish_kumar

The code provided above is to be used in invoke code activity and create an argument dt as datatable and with in/out as direction…and assign your actual datatable to that variable…

That is not to be used in assign

cheers

1 Like