Worksheet Data Structure

IWorksheetData

IWorksheetData represents the snapshot of a worksheet in Univer Sheet.

Properties

PropertyTypeDescription
idstringUnique identifier for the worksheet.
namestringName of the worksheet.
tabColorstringColor of the worksheet tab.
hiddenBooleanNumberWhether the sheet is hidden. Default: BooleanNumber.FALSE.
freezeIFreezeFreeze pane settings.
rowCountnumberTotal number of rows.
columnCountnumberTotal number of columns.
defaultColumnWidthnumberDefault width for columns, unit px.
defaultRowHeightnumberDefault height for rows, unit px.
mergeDataIRange[]Array of merged cell ranges.
cellDataIObjectMatrixPrimitiveType<ICellData>Matrix of cell contents. More details.
rowDataIObjectArrayPrimitiveType<Partial<IRowData>>Array of row data objects.
columnDataIObjectArrayPrimitiveType<Partial<IColumnData>>Array of column data objects.
rowHeader{ width: number; hidden?: BooleanNumber; }Row header configuration.
columnHeader{ height: number; hidden?: BooleanNumber; }Column header configuration.
showGridlinesBooleanNumberWhether gridlines are visible.
rightToLeftBooleanNumberWhether the worksheet is in right-to-left mode.
defaultStyle?Nullable<IStyleData>The default style of worksheet

Example

TypeScript
const worksheetData: IWorksheetData = {  id: 'sheet1',  name: 'Sheet 1',  tabColor: '#FF0000',  hidden: BooleanNumber.FALSE,  freeze: { xSplit: 1, ySplit: 1, startRow: 1, startColumn: 1 },  rowCount: 1000,  columnCount: 26,  defaultColumnWidth: 100,  defaultRowHeight: 25,  mergeData: [],  cellData: {    0: {      0: {        v: 123,      },    },  },  rowData: [],  columnData: [],  rowHeader: { width: 40 },  columnHeader: { height: 20 },  showGridlines: BooleanNumber.TRUE,  rightToLeft: BooleanNumber.FALSE,}

This structure provides a comprehensive representation of worksheet data, including layout, content, and display settings.

Full Example

TypeScript
const workbook: IWorkbookData = {  id: 'gyI0JO',  sheetOrder: [    'RSfWjJFv4opmE1JaiRj80',  ],  name: '',  appVersion: '0.10.2',  locale: 'enUS',  styles: {},  sheets: {    RSfWjJFv4opmE1JaiRj80: {      id: 'RSfWjJFv4opmE1JaiRj80',      name: 'Test',      tabColor: '',      hidden: 0,      rowCount: 30,      columnCount: 10,      zoomRatio: 1,      freeze: {        startRow: -1,        startColumn: -1,        ySplit: 0,        xSplit: 0,      },      scrollTop: 0,      scrollLeft: 0,      defaultColumnWidth: 73,      defaultRowHeight: 23,      mergeData: [],      cellData: {},      rowData: {},      columnData: {        0: {          w: 125,          hd: 0,        },        1: {          w: 125,          hd: 0,        },        2: {          w: 125,          hd: 0,        },        3: {          w: 125,          hd: 0,        },        4: {          w: 125,          hd: 0,        },        5: {          w: 125,          hd: 0,        },        6: {          w: 125,          hd: 0,        },        7: {          w: 125,          hd: 0,        },        8: {          w: 125,          hd: 0,        },        9: {          w: 125,          hd: 0,        },      },      showGridlines: 1,      rowHeader: {        width: 46,        hidden: 0,      },      columnHeader: {        height: 20,        hidden: 0,      },      rightToLeft: 0,    },  },  resources: [    {      name: 'SHEET_DEFINED_NAME_PLUGIN',      data: '',    },  ],}

How is this guide?

© 2026 DreamNum Co., Ltd.