# Estructura de datos de la hoja de trabajo

- Human documentation: [https://docs.univer.ai/es-ES/guides/sheets/model/worksheet-data](https://docs.univer.ai/es-ES/guides/sheets/model/worksheet-data)

- Agent Markdown: [https://docs.univer.ai/es-ES/guides/sheets/model/worksheet-data.md](https://docs.univer.ai/es-ES/guides/sheets/model/worksheet-data.md)

- Requested language: `es-ES`

- Content language: `es-ES`

- Documentation version: `1.2.0`

- Source: [sheets/model/worksheet-data.es-ES.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/sheets/model/worksheet-data.es-ES.mdx)

---

## IWorksheetData

[`IWorksheetData`](https://docs.univer.ai/es-ES/reference/types/worksheet-data.md) representa la instantánea de una hoja de trabajo en Univer Sheet.

### Propiedades

| Propiedad                                                   | Tipo                                              | Descripción                                                                                                                                                 |
| ----------------------------------------------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                                                          | `string`                                          | Identificador único de la hoja de trabajo.                                                                                                                  |
| name                                                        | `string`                                          | Nombre de la hoja de trabajo.                                                                                                                               |
| tabColor                                                    | `string`                                          | Color de la pestaña de la hoja de trabajo.                                                                                                                  |
| hidden                                                      | `BooleanNumber`                                   | Si la hoja está oculta. Valor predeterminado: `BooleanNumber.FALSE`.                                                                                        |
| freeze                                                      | `IFreeze`                                         | Configuración del panel congelado.                                                                                                                          |
| rowCount                                                    | `number`                                          | Número total de filas.                                                                                                                                      |
| columnCount                                                 | `number`                                          | Número total de columnas.                                                                                                                                   |
| defaultColumnWidth                                          | `number`                                          | Ancho predeterminado para columnas, unidad `px`.                                                                                                            |
| defaultRowHeight                                            | `number`                                          | Alto predeterminado para filas, unidad `px`.                                                                                                                |
| mergeData                                                   | `IRange[]`                                        | Matriz de rangos de celdas fusionadas.                                                                                                                      |
| cellData                                                    | `IObjectMatrixPrimitiveType<ICellData>`           | Matriz de contenidos de celdas. [Más detalles.](https://docs.univer.ai/es-ES/guides/sheets/model/cell-data.md)                                                                             |
| rowData                                                     | `IObjectArrayPrimitiveType<Partial<IRowData>>`    | Matriz de objetos de datos de fila.                                                                                                                         |
| columnData                                                  | `IObjectArrayPrimitiveType<Partial<IColumnData>>` | Matriz de objetos de datos de columna.                                                                                                                      |
| rowHeader                                                   | `{ width: number; hidden?: BooleanNumber; }`      | Configuración del encabezado de fila.                                                                                                                       |
| columnHeader                                                | `{ height: number; hidden?: BooleanNumber; }`     | Configuración del encabezado de columna.                                                                                                                    |
| backgroundImage?                                            | `IWorksheetBackgroundImage`                       | Fuente opcional: `{ source: string; imageSourceType: ImageSourceType }`. Consulta [imágenes de fondo](https://docs.univer.ai/es-ES/guides/sheets/features/images.md#worksheet-background). |
| showGridlines                                               | `BooleanNumber`                                   | Si las líneas de la cuadrícula son visibles.                                                                                                                |
| rightToLeft                                                 | `BooleanNumber`                                   | Si la hoja de cálculo está en modo de derecha a izquierda.                                                                                                  |
| [defaultStyle](https://docs.univer.ai/es-ES/guides/sheets/features/core/default-style.md)? | `Nullable<IStyleData>`                            | El estilo predeterminado de hoja de trabajo                                                                                                                 |

### Ejemplo

```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,
}
```

Esta estructura proporciona una representación completa de la hoja de trabajo datos, incluido el diseño, el contenido y la configuración de visualización.

## Ejemplo completo

```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: '',
    },
  ],
}
```
