> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetformatcellrange.md).

# SpreadsheetFormatCellRange

Formats a range of cells in a spreadsheet with a single format struct.

## Method Signature

```
SpreadsheetFormatCellRange(spreadsheetObj=[any], format=[any], startRow=[any], startColumn=[any], endRow=[any], endColumn=[any])
```

### Arguments

| Argument         | Type      | Required | Description                                                                   | Default |
| ---------------- | --------- | -------- | ----------------------------------------------------------------------------- | ------- |
| `spreadsheetObj` | `ANY`     | `true`   | The spreadsheet object.                                                       |         |
| `format`         | `STRUCT`  | `true`   | The format struct containing style properties (alignment, bold, color, etc.). |         |
| `startRow`       | `NUMERIC` | `true`   | The starting row number (1-based).                                            |         |
| `startColumn`    | `NUMERIC` | `true`   | The starting column number (1-based).                                         |         |
| `endRow`         | `NUMERIC` | `true`   | The ending row number (1-based).                                              |         |
| `endColumn`      | `NUMERIC` | `true`   | The ending column number (1-based).                                           |         |

## Examples

Format a range of cells:

```js
// Format cells A1:C3
var spreadsheet = SpreadsheetNew();
SpreadsheetAddRows( spreadsheet, [ ["A", "B", "C"], ["1", "2", "3"], ["X", "Y", "Z"] ] );

var format = { bold = true, background = "FFFF00", alignment = "center" };
SpreadsheetFormatCellRange( spreadsheet, 1, 1, 3, 3, format );
```

Style table headers:

```js
// Format header row
var spreadsheet = SpreadsheetNew();
SpreadsheetAddRow( spreadsheet, [ "Name", "Email", "Phone" ] );
SpreadsheetAddRow( spreadsheet, [ "John", "john@example.com", "555-1234" ] );

var headerFormat = { bold = true, color = "FFFFFF", background = "000000" };
SpreadsheetFormatCellRange( spreadsheet, 1, 1, 1, 3, headerFormat );
```

## Related

* [SpreadsheetFormatCell()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetformatcell.md) - Format single cell
* [SpreadsheetFormatRow()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetformatrow.md) - Format entire row
* [SpreadsheetFormatColumn()](/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetformatcolumn.md) - Format entire column


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-+-++/modules/bx-spreadsheet/built-in-functions/spreadsheetformatcellrange.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
