# styleRange

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

Apply a style to every existing cell in a range.

Mutates `ws` in place and returns the same worksheet for chaining. When
`createCells` is true, missing cells in the range are created as styled stubs.

```ts
styleRange(ws: WorkSheet, range: string | Range, style: CellStyle, opts?: {
    createCells?: boolean;
}): WorkSheet
```

## Parameters

| Name | Type | Required |
| --- | --- | --- |
| ` ws ` | [` WorkSheet `](</xlsx-format/api-reference/interfaces/worksheet/>) | Yes |
| ` range ` | ` string \| ` [` Range `](</xlsx-format/api-reference/interfaces/range/>) | Yes |
| ` style ` | [` CellStyle `](</xlsx-format/api-reference/interfaces/cellstyle/>) | Yes |
| ` opts ` | ` { createCells?: boolean } ` | No |

## Returns

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