Hi,
Thanks for using Aspose.Cells.
Please try the following code and read its comments. I have attached the
output excel file for your reference. As you can see in the output excel file, that column U contents are in ascending order. If you find any problem in output excel file, please feel free to let us know, we will look into it further.
Java
//Load your workbook
Workbook wb = new Workbook(dirPath + “results.xlsx”);
//Perform calculation of formulas by Aspose.Cells.
//It is recommended but if you things are not working, then it is necessary
wb.calculateFormula();
//Access your worksheet
Worksheet ws = wb.getWorksheets().get(“Analysis”);
//Create your cell area
CellArea ca = CellArea.createCellArea(“O2”, “U89”);
//Create your sorter
DataSorter sorter = wb.getDataSorter();
//Find the index, since we want to sort by column U, so we should know
//the index for sorter
int idx = CellsHelper.columnNameToIndex(“U”);
//Add key in sorter, it will sort in Ascending order
sorter.addKey(idx, SortOrder.ASCENDING);
//Perform sort
sorter.sort(ws.getCells(), ca);
//Save the workbook in xlsx format
wb.save(dirPath + “output.xlsx”);
C#
//Load your workbook
Workbook wb = new Workbook(“results.xlsx”);
//Perform calculation of formulas by Aspose.Cells.
//It is recommended but if you things are not working, then it is necessary
wb.CalculateFormula();
//Access your worksheet
Worksheet ws = wb.Worksheets[“Analysis”];
//Create your cell area
CellArea ca = CellArea.CreateCellArea(“O2”, “U89”);
//Create your sorter
DataSorter sorter = wb.DataSorter;
//Find the index, since we want to sort by column U, so we should know
//the index for sorter
int idx = CellsHelper.ColumnNameToIndex(“U”);
//Add key in sorter, it will sort in Ascending order
sorter.AddKey(idx, SortOrder.Ascending);
//Perform sort
sorter.Sort(ws.Cells, ca);
//Save the workbook in xlsx format
wb.Save(“output.xlsx”);