Automatically sorting the column and surrounding columns

Aug 28, 2012 at 9:56 PM

I have 6 columns, A-F, I need to sort these in ascending order based on column F. I can't find a sort function anywhere in the examples so either I'm overlooking it or something. Help is appricated

Editor
Aug 29, 2012 at 11:44 AM

I'm pretty sure only with pivot table you can sort columns, but you can sort your collection programmatically using linq ( or another sort method ). Another option, maybe it is using a template file or do it with vba code.

Nov 1, 2012 at 6:03 PM

Are there any thoughts of adding the possibility to set the sort for different columns when AutoFilter is ON? That feature would be very welcome by me.

Dec 6, 2012 at 8:52 AM

I am also interested in it. Is it possible to use sorting within one column? When I click on filters in Excel spreadsheet then there are options to sort it from largest to smallest values and vice versa.

 

Regards,

Mateusz

Dec 20, 2012 at 8:51 AM

I've added a feature request for sorting by column, please vote for it if you think it's important.

http://epplus.codeplex.com/workitem/14791

Dec 21, 2012 at 5:41 AM
Edited Dec 21, 2012 at 5:53 AM

My approach is to organize the data first into a DataTable that has the layout  I want.  Then to import it into  a worksheet using  .LoadFromDataTable method.  The neat thing with DataTables is that if you are working with data from SQL Server or MySQL you can do a SQL Select and shovel the whole SQL query result into a DataTable with one line of code using a SqlDataReader (SQL Server) or MySqlDataReader (MySQL).  This way you use the flexibility of C# to get and organize the data how you want it and are less reliant on epplus.