Excel automation based on column values

HI Guys,

Would like to do som excel automation, I have input values in one column as like below:

and I need output as follows in another sheet or in another excel:

Please help me out on this, thank you.

@gokulvasant, can you share the excel file?

Hi @gokulvasant

You can use the below activity to transpose the data from rows to columns…
Data Manipulations - RPA Component | UiPath Marketplace

It also contains a user guide where you can refer and understand how to use it :slight_smile:

I prototyped with following reduced sample data:

Stage 1: Finding NSF Name Indexes:
we can do with the help of Enumerable:

(From i In Enumerable.Range(0, dtData.Rows.Count).ToList
Where dtData.Rows(i)(0).toString.StartsWith("NSG")
Select i).ToArray
  • Creating a sequence starting by 0 with the length of datarows count (0,1,2,3…)
  • use the index within a loop and filter out Values starting with NSF
  • project the index into an int array - Result: 0,3

Stage 2: Parse the datatable
Based on the found indexes the blocks can be parsed with Skip and Take method
the Barcode Lines will be added to a intermediate DataTable:

Stage 3: Group By LOC and Barcode the group Counts will be taken and added to the Result Table:

(From d In dt2.AsEnumerable
Group d By k1=d(0).toString.Trim, k2=d(1).toString.Trim Into grp=Group
let ra = New Object() {k1,k2,grp.Count}
Select dtResult.Rows.Add(ra)).CopyToDataTable

Final Result:

For fast Prototyping reasons LINQ was used. But also these Parts can be decomposed into more essential activities.

Find Starter Help here:
gokulvasant.xaml (11.4 KB)

1 Like

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