Trim an excel column with thousands of data

Hi, I want to trim leading spaces for an excel column which contains 5000 records i could not loop through each row which takes more time. Is there any other more efficient way to trim an excel column with thousands of data. Please help

Thanks

Hi @Muthulakshmi_Thangamuthu

Do this way

  1. Read the excel field and store in varible Dt1

  2. Then use assign activitiy to use the following
    linq query

NewDt = Dt1.AsEnumerable().Where(Function(row) row(ColumnName).ToString.Trim). CopyToDatatable

Write the NewDt to an Excel file using write range

Hope it helps you

Mark it as solution if you got it

Regards

Nived N :robot:

Happy Automation :slight_smile:

1 Like

@Muthulakshmi_Thangamuthu
have a look here:
Trim_AllCellsAllRows.xaml (7.6 KB)

it is trimmimg in all rows in all columns

1 Like

Hi thanks for the reply, I tried but its not working.Capture

Am i doing it right?