Sorting by Column in generated spreadsheet

Is there a way to programmatically sort the spreadsheet data in the generated Excel sheet using the Aspose.Excel component?

Hi Kevin,

Currently Aspose.Excel doesn’t provide such a method to sort data. Could you elaborate your needs specifically?

And could you sort your data before put into the generated Excel sheet. We provide Cells.ImportDataTable and Cells.ImportDataView to import the sorted data.

Aspose.Cells is intrdouced which has replaced Aspose.Excel. This new product has much more advance features and is better in performance as compared to the discarded product Aspose.Excel. This new product Aspose.Cells has capability to sort data in the spreadsheet as shown in the following sample code:

// Instantiate a new Workbook object.
// Load a template file.
Workbook workbook = new Workbook(dataDir + "book1.xls");

// Get the workbook datasorter object.
DataSorter sorter = workbook.DataSorter;

// Set the first order for datasorter object.
sorter.Order1 = Aspose.Cells.SortOrder.Descending;

// Define the first key.
sorter.Key1 = 0;

// Set the second order for datasorter object.
sorter.Order2 = Aspose.Cells.SortOrder.Ascending;

// Define the second key.
sorter.Key2 = 1;

// Create a cells area (range).
CellArea ca = new CellArea();

// Specify the start row index.
ca.StartRow = 0;

// Specify the start column index.
ca.StartColumn = 0;

// Specify the last row index.
ca.EndRow = 13;

// Specify the last column index.
ca.EndColumn = 1;

// Sort data in the specified data range (A1:B14)
sorter.Sort(workbook.Worksheets[0].Cells, ca);

// Save the excel file.
workbook.Save(dataDir + "output.out.xls");

Here is an article which provides more details about this feature:
Data Sorting

Download the free trial of this version here:
Aspose.Cells for .NET (Latest Version)

A runnable solution which can be used to test number of features is available here.