Add to list

hello friends
i want to read column from excel called company name that have 100 company name and save it in the list without repetitive the company name
how can i do that?

Hi!

you can achieve this by using the

datatable.DefaultView.ToTable(True,“Column Name”)

please refer:

Defaultview

Regards,
NaNi

@Ahmad_Samen

  1. Use Read Range activity to read the data from Excel file and it will give output as DataTable. Let’s say InputDT.

  2. And then use below expression to remove duplicate company names from Company column.

       CompanyDT = InputDT.DefaultView.ToTable(True,"Company Name")
    
  3. And then use Output DataTable activity to convert CompanyDT DataTable to string. Let’s say CompanyNames.

  4. And then use below expression to convert it to list.

           LstCompany = CompanyNames.Split(Environment.NewLine.ToCharArray)

ListCompanyNames | List(Of String) =

dtData.AsEnumerable.Select(Function (x) x(YourColNameOrIndex).toString.trim).Distinct().toList