Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
To sort data in Microsoft Excel:
Generally, sorting is performed on a list — defined as a contiguous group of data where the data is displayed in columns.
Aspose.Cells for Python via .NET provides the DataSorter class used to sort data in ascending or descending order. The class has some important members, for example, properties like Key1 … Key3 and Order1 … Order3. These members are used to define sorted keys and specify the key sort order.
You have to define keys and set the sort order before implementing data sorting. The class provides the sort method used to perform data sorting based on the cell data in a worksheet.
The sort method accepts the following parameters:
This example uses the template file “Book1.xls” created in Microsoft Excel. After executing the code below, data is sorted appropriately.
Excel provides features to sort data based on the background color. The same feature is provided using Aspose.Cells for Python via .NET using DataSorter where SortOnType CellColor can be used in add_key() to sort data based on the background color. All the cells which contain the specified color in the add_key() function are placed on top or bottom according to the SortOrder setting, and the order of the rest of the cells is not changed at all.
Following are the sample files which can be downloaded for testing this feature:
outputsampleBackGroundFile.xlsx
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.