# addArrayToSheet

Source: /xlsx-format/api-reference/functions/addarraytosheet

Add an array-of-arrays to an existing worksheet, or create a new one.

Each inner array represents a row, and each element within it a cell value.
Supports dense and sparse storage modes, origin offsets, date handling,
and automatic type detection (number, boolean, string, date, error).

```ts
addArrayToSheet(worksheet: WorkSheet | null, data: any[][], opts?: AOA2SheetOpts): WorkSheet
```

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| ` worksheet ` | [` WorkSheet `](</xlsx-format/api-reference/interfaces/worksheet/>) ` \| null ` | Yes | An existing worksheet to append to, or `null` to create a new one |
| ` data ` | ` any[][] ` | Yes | The array-of-arrays containing raw cell values |
| ` opts ` | [` AOA2SheetOpts `](</xlsx-format/api-reference/interfaces/aoa2sheetopts/>) | No | Optional settings (origin, dense, dateNF, cellDates, UTC, date1904, nullError, sheetStubs) |

## Returns

[` WorkSheet `](</xlsx-format/api-reference/interfaces/worksheet/>)

The updated or newly created worksheet
