FWorksheetSort

GitHubEdit on GitHub
packages@univerjs/sheets-sort

APIs

sort

Sort the worksheet by the specified column.

Signature

sort(colIndex: number, asc?: boolean = true): FWorksheet

Parameters

  • colIndex (number) — The column index to sort by.
  • asc (boolean) — The sort order. true for ascending, false for descending. The column A index is 0.

Returns

  • (FWorksheet) — The worksheet itself for chaining.

Examples

const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()

// Sorts the worksheet by the column A in ascending order.
fWorksheet.sort(0)

// Sorts the worksheet by the column A in descending order.
fWorksheet.sort(0, false)

Table of Contents

Capalyze