Sort data write data to excel file

Hi Everyone

I have difficult exercise when want to sort and arrange data from excel to another file.

The source file and destination file I want as below picture and attached file.

I want to find the model which has " capacity " column largest and " % " column largest and write one by one to destination file with format is fixed .

Pls kindly support me this exercise.

Thanks in advance!
Source.xlsx (8.3 KB)
Destination.xlsx (8.7 KB)

1 Like

One of the solution is that you use Sort Data Table activity.

  1. Excel application scope > Read Range
  2. Sort DataTable
  3. Excel Application Score > Write Range

You probably can also use just the Sort Table activity, but i already had this.

SortTable.xaml (6.8 KB)

2 Likes

Hi @srdjan.suc

Thanks you but that is not solution for me.

1 Like

@trunghai

  1. Sort table using sort data table activity
  2. Use Transpose method
2 Likes

hi @amaresan

Thanks you but you can make a XAML file for this?

I want to sort base on 2 condition :

  1. It will sort with capacity column descending
  2. If the model has capacity same, it will sort base on % column descending.
1 Like

@trunghai

Put below code in if condition

dt.Rows.IndexOf(dt.AsEnumerable().Where(Function(row) row(0).ToString.Contains("%")).ToArray()(0))>0

true then put sort by % column otherwise sort by Capacity col

2 Likes

Hi @amaresan

thanks you but I want it sort descending with condition : the Capacity is largest , if the capacity same then it sort with % largest.

And I want after sorting, it will write into the destination file with format as below.

Thanks you!
Destination.xlsx (8.7 KB)

1 Like

@trunghai

Sorry i did’t understand your requirement properly

You have two Option

  1. Excel wise
  2. Sql Datatable wise

Excel wise
1.Use Click Home ->Click Sort&Ascending -> choose Z to A
2. Use Tranpose formula

Sql DataTable wise

  1. Use Connect Activity
  2. wirte Sql query for Ascending and Povit table(Which means Tranpose)
2 Likes

Hi @amaresan

Thanks you so much but I want to use uipath to do this case although VBA can resolved.

1 Like