Sort elements in a excel document and save it in a new sheet

Hi everyone,
i just beginn with uipath and i have some isues with a Task i got. I have a Excel document with differents types of element inside and i want to extract all the Elements per cathogory and save each of them in a new sheet.
i tried with try catch activity , using .ToString.Sum but i didn’t knew what ecxatly to write. i also use sort table etc… but i failed. i will very appreciate your heps.(sorry for my english, i am not a native Speaker :slight_smile: )
if i want for example to cathegorize the fruits in this table and save each of them in a new sheet how can i do that?
thanks in advance.
image

Can you please attach the excel file

@4ever
Refer this it might help you

Regards,
Mahesh

here it is

please drag and drop the excel file

@4ever, Welcome to community :slight_smile: You are in the right place to clarify things.

We have UiPath Academy offering free course. Have a look

Suggestions:

  1. It will be good if you search for the existing solutions in the forum for your requirement before you post.
  2. Your posts reaches more people if place your query in the right category. Move it from Ideas to HowTo section. There is high chance you getting more and best solutions.
  3. Start with the links shared by mahesh. This path will be adventurous.

Regards,
Dom :slight_smile:

fruits.xlsx (8.2 KB)

allright @Dominic thank you for your advice :slight_smile:

1 Like

thanks

Hi @MAHESH1,
conserning the defaultview (“[Name] ASC, [Index No] Desc”):

  • In [Name] ASC : i suppose i have to write what i want to sort. for example Mango
  • [Index No]: should i just give a big number and make sure that is bigger than the number of element i have? because in case i have a very big list, i wont know exactly the number of Elements inside the table.
    when i try with defautview i have this exeption:

here is the data

sort table fruit.xaml (10.4 KB)

Hi @4ever,
use this
sort table fruit.xaml (10.3 KB)

Regards,
Arivu

@MAHESH1 @arivu96 @Dominic The solution you Said is fine for current scenario. I got one doubt what happens if there is huge data of different names of string type we cant hard code like sort by “mango” or “Apple”

like this :grinning:
DataTable.AsEnumerable().Where(Function(row) row(“fruit”).ToString = “apple”).CopyToDataTable()

Regards,
Raj

@RajaSekhar9
I didn’t understand your requirement properly.
I will explain you what i understand
Date,Fruit,Price
1/2/2017,Mango,5
2/2/2017,Mango,6
3/2/2017,Apple,7
3/2/2017,Apple,8
4/2/2017,Orange,9
5/2/2017,Orange,10

Do you want to get the rows having apple and paste it in a sheet and Mango in different sheetand Orange in diffrent sheet .

Sorry If Iam wrong.

Regards,
Mahesh

I understand upto sorting. how to extract each type of fruit and generate Excel file.If there a countless type of fruit

Hi @arivu96
i have the same exeption’s message

it seem like there is a Problem in the first Assign activity

@4ever
try this Query
First Read your excel sheet and store it in a datatable dta

Collection=(From p In dta.Select()
Group p by Fruit=p.Item(“Fruit”).ToString Into Group
Select Group)

Collection type should be IEnumerable<IEnumerable< DataRows>

Then Run For Each for the collection The element type should be IEnumerable
Then Inside that Convert Item.CopyToDataTable and use the same to write in excel sheet.
Loop in such a way that it should write in different excel sheet

Regards,
Mahesh