How to Sort a column from A to Z in excel?

Hi All,

I have a question, obviously, otherwise i would not be asking it LOL. How can i sort a column from A to Z in an excel file?

I am trying to use the Sort table in an excel scope but when i run it i get Sort Table: The table does not exist.Note: if downloading the file just use a basic excel files with some names.ExcelFilter.xaml (5.1 KB)

1 Like

@Sidney_Vogel

Try this.

     datatable sortDT =(From row In inputDT.Select Order By (row("ColumnName").Tostring) Select row).ToArray.CopyToDatatable()
2 Likes

Hi @lakshman what i dont understand is what does the datatable refer to in this case?

@Sidney_Vogel

  1. First use Read Range activity to read the data from excel file and will give you output as DataTable and say ‘inputDT’.

  2. And then try above expression and replace ColumnName with your required ColumnName you want to sort it based on that.

  3. And we are assigned sorted data to new DataTable and say ‘sortDT’. And then use Write Range activity and pass this DataTable as input to it and write into Excel file.

Hi @Sidney_Vogel,
You have to create the table. Check this one…

Regards
Balamurugan.S

Is there any other way of sorting data in a column from A to Z without adding a datatable?? what if the report doesn’t have a datatable?

I am also getting an error stating: The range does not exist.

1 Like

Hi @Sidney_Vogel,

Can you please check this…

Regards
Balamurugan.S

Hi @balupad14, thank you for the sample, how ever there is a missing activity, heres the screenshoot, take a look and please advise.

1 Like

Hi,
Install this package. and reopen the studio.

Regards
Balamurugan.S

@balupad14 Thank you, i will try it and will let you know how it goes, thanks for all the help.

1 Like

Hi @balupad14, i am having a bit of confusion here, maybe i am not explaining what i need, please take a look at this excel fileSort from A to Z.xlsx (8.0 KB) , its just a simple file with some characters that represent names in a non order, ill i need is to sort the row so that it is sorted alphabetically from A to Z.

1 Like

SortExcel.7z (14.0 KB)

I think this is want you want to do. In that project, there 2 alternatives to sort the datatable.

Cheers.

I see the sample project you uploaded for sorting columns.
But, in my case, I have already tables created in Excel, and by using that table, I am not able to sort the column.

Can you suggest me what to do here?