Excel Activities First row of each element question

Hi
I have this Table in an excel file and i want to keep only the first row of each School
Capture d’écran aa2023-04-30 161236
how can i do it

@kawtar.ettayarssouti

Use remove duplicates activity …

And provide the column name of "School"…in the add column field and then it would remove the duplicates

Select compare individual columns and check has headers to give the column name

https://docs.uipath.com/activities/other/latest/user-guide/remove-duplicates-x

Cheers

Hi @kawtar.ettayarssouti ,

Maybe an alternative way using the Datatable approach (If already reading the data as Datatable) :

OutputDT = DT.AsEnumerable.GroupBy(Function(x)x("School").ToString).Select(Function(x)x.First).CopyToDatatable

Here, DT is the data read from Excel sheet as Datatable, OutputDT is the filtered Datatable.

Let us know if you require further help on this.

my DataTables are declared but i get this error : ‘DT’ is not declared. It may be inaccessible due to its level of protection. At line 1
‘OutputDT’ is not declared. It may be inaccessible due to its level of protection. At line 1

@kawtar.ettayarssouti ,

These were modeled based on my variables. You can use the Datatable variables that you have created or output from Read Range activity.

Note, OutpuDT is to be created as a Datatable variable.

i did actually i modified them to the ones i have in workflow but still not working

@kawtar.ettayarssouti ,

Could you maybe re-paste the Expression again and check?

  1. Copy the Expression. Remove the Expression
  2. Save the Workflow.
  3. Paste the Expression back.

Also, Do show us with a Screenshot of How you have implemented it.

OutputDT.AsEnumerable().GroupBy(Function(x)x(“Text File Name”).ToString).Select(Function(x)x.First).CopyToDatatable

i added “()” after “AsEnumerable”
and did what you told me and it worked perfectly
Thank you so much

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.