# ICellData

> Language fallback: requested `zh-CN`; content is `en-US`.

- Human documentation: [https://docs.univer.ai/zh-CN/reference/types/cell-data](https://docs.univer.ai/zh-CN/reference/types/cell-data)

- Agent Markdown: [https://docs.univer.ai/zh-CN/reference/types/cell-data.md](https://docs.univer.ai/zh-CN/reference/types/cell-data.md)

- Requested language: `zh-CN`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [types/cell-data.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/types/cell-data.mdx)

---

The stored content and formatting of one cell. Use `v` for plain values, `f` for formulas, `p` for rich text, and `s` for styles. Pass cell data to [`FRange.setValue`](https://docs.univer.ai/zh-CN/reference/facade/range.md#setvalue) or [`setValues`](https://docs.univer.ai/zh-CN/reference/facade/range.md#setvalues).

```ts
import type { ICellData } from '@univerjs/core'
import { CellValueType } from '@univerjs/core'

const amount: ICellData = { v: 42, t: CellValueType.NUMBER }
const formula: ICellData = { f: '=SUM(A1:A5)' }
const label: ICellData = { v: '00123', t: CellValueType.FORCE_STRING }
```

## Import

```ts
import type { ICellData } from '@univerjs/core'
```

## Definition

```ts
interface ICellData {
  p?: Nullable<IDocumentData>

  s?: Nullable<IStyleData | string>

  v?: Nullable<CellValue>
  t?: Nullable<CellValueType>

  f?: Nullable<string>

  ref?: Nullable<string>

  xf?: Nullable<string>

  si?: Nullable<string>

  custom?: CustomData
}
```

## Fields

### `p`

Optional · `Nullable<IDocumentData>`

Rich text stored as a document snapshot. Plain values use `v` instead.

### `s`

Optional · `Nullable<string | IStyleData>`

An inline cell style or a style ID from `IWorkbookData.styles`.

### `v`

Optional · `Nullable<CellValue>`

The plain cell value: a string, number, or boolean. Use `null` to clear the value.

### `t`

Optional · `Nullable<CellValueType>`

The value type. Univer normally infers it; use `CellValueType.FORCE_STRING` to keep numeric-looking text as text.

### `f`

Optional · `Nullable<string>`

A formula beginning with `=`, such as `=SUM(A1:B4)`.

### `ref`

Optional · `Nullable<string>`

If the formula is a formula array, this field is used to store the referencing range.

### `xf`

Optional · `Nullable<string>`

New Excel formulas need to add prefixes for differentiation, e.g., \_xlfn.\_xlws. \_xlfn. \_xlws. \_xludf.

### `si`

Optional · `Nullable<string>`

Id of the formula.

### `custom`

Optional · `CustomData`

User stored custom fields.

## Related types

* [`IDocumentData`](https://docs.univer.ai/zh-CN/reference/types/document-data.md)
* [`Nullable`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/shared/types.d.ts)
* [`IStyleData`](https://docs.univer.ai/zh-CN/reference/types/style-data.md)
* [`CellValue`](https://docs.univer.ai/zh-CN/reference/types/cell-value.md)
* [`CellValueType`](https://docs.univer.ai/zh-CN/reference/enums/cell-value-type.md)
* [`CustomData`](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/sheets/typedef.d.ts)

**Package:** [`@univerjs/core`](https://docs.univer.ai/zh-CN/reference/packages/plugins/univerjs/core.md) · [Type definitions](https://unpkg.com/@univerjs/core@1.0.0-rc.0/lib/types/sheets/typedef.d.ts)
