@univerjs/sheets-sort v0.5.4


Interface: IFWorksheetSort

Defined in: sheets-sort/src/facade/f-worksheet.ts:23

Methods

sort()

sort(colIndex, asc?): FWorksheet

Defined in: sheets-sort/src/facade/f-worksheet.ts:37

Sort the worksheet by the specified column.

Parameters

ParameterTypeDescription
colIndexnumberThe column index to sort by. which starts from 1.
asc?booleanThe sort order. true for ascending, false for descending.

Returns

FWorksheet

The worksheet itself for chaining.

Example

const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
activeSheet.sort(1); // Sorts the worksheet by the first column in ascending order.
activeSheet.sort(1, false); // Sorts the worksheet by the first column in descending order.