# Range Class

> Range class in the browser JavaScript API: A worksheet-bound rectangular range for atomic bulk reads, writes, formatting and copy operations.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Path:** TX Sheet Control > API Reference > JavaScript API > Browser Editor > Range Class
- **1163 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/llms-full.txt

---

A worksheet-bound rectangular range for atomic bulk reads, writes, formatting and copy operations. Range operations retain protection, validation and shared transaction semantics.

Package: `@txtextcontrol/tx-sheet-control`. Version: **2.0.0**.

ES module import: `import { Range } from '@txtextcontrol/tx-sheet-control';`.

### Constructor

```javascript
new Range(sheet, ref)
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `sheet` | `Worksheet` | No | Value matching sheet's declared type and the owning object's validation rules. |
| `ref` | `string` | No | Value matching ref's declared type and the owning object's validation rules. |

Returns: `Range`.

### Members

#### Properties

| Property | Description |
|---|---|
| [address](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/address-property/llms-full.txt) | The address value of Range. |
| [bounds](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/bounds-property/llms-full.txt) | The bounds value of Range. |
| [columnCount](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/columncount-property/llms-full.txt) | The columnCount value of Range. |
| [rowCount](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/rowcount-property/llms-full.txt) | The rowCount value of Range. |
| [sheet](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/sheet-property/llms-full.txt) | The sheet value of Range. |
| [values](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/values-property/llms-full.txt) | The values value of Range. |

#### Methods

| Method | Description |
|---|---|
| [clear](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/clear-method/llms-full.txt) | Clear content and/or formatting. |
| [copyTo](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/copyto-method/llms-full.txt) | Copy cells within the same workbook using the selected paste mode in one undoable operation. |
| [fillTo](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/fillto-method/llms-full.txt) | The fillTo operation of Range. |
| [format](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/format-method/llms-full.txt) | Apply a nested/flat style patch to the whole range. |
| [merge](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/merge-method/llms-full.txt) | Merge the range; across merges each row separately. |
| [read](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/read-method/llms-full.txt) | Read flat address/text/value/display/style records. |
| [setFormulas](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setformulas-method/llms-full.txt) | Write explicit formulas. |
| [setInputs](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setinputs-method/llms-full.txt) | Write entered-content strings. |
| [setValidation](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setvalidation-method/llms-full.txt) | The setValidation operation of Range. |
| [setValues](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setvalues-method/llms-full.txt) | Write a typed matrix of matching dimensions. |
| [unmerge](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/unmerge-method/llms-full.txt) | Remove intersecting merges. |

### Examples

Use a fresh workbook. Create and format the sample data, apply this API and retain the returned document or result in your application. In the browser pass editor.workbook; in Node.js pass the server control.

```javascript
function createRangeReport(book) {
    const sheet = book.sheets.at(0);
    sheet.cell('A1').setText('October invoice');
    sheet.cell('A1').format({
        fontFamily: 'Liberation Sans',
        fontSize: 16,
        bold: true,
        textColor: '#ffffff',
        fillColor: '#163b63',
    });

    sheet.columns.at(0).setWidth({ pixels: 240 });
    sheet.range('B8:B9').setValues([[120], [80]]);
    sheet.cell('B10').setFormula('=SUM(B8:B9)');
    sheet.range('B8:B10').format({ numberFormatCode: '#,##0.00', fontSize: 11 });
    return sheet;
}
```

### See Also

- [JavaScript Browser Editor API](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)

---

## In This Section

- [Range.address Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/address-property/llms-full.txt): Range.address property in the TX Sheet Control JavaScript API for the browser, with its type string and a JavaScript example.
- [Range.bounds Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/bounds-property/llms-full.txt): Range.bounds property in the TX Sheet Control JavaScript API for the browser, with its type CellRange and a JavaScript example.
- [Range.clear Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/clear-method/llms-full.txt): Range.clear method in the TX Sheet Control JavaScript API for the browser: Clear content and/or formatting. Includes the syntax and a JavaScript example.
- [Range.columnCount Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/columncount-property/llms-full.txt): Range.columnCount property in the TX Sheet Control JavaScript API for the browser, with its type number and a JavaScript example.
- [Range.copyTo Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/copyto-method/llms-full.txt): Range.copyTo method in the browser JavaScript API: Copy cells within the same workbook using the selected paste mode in one undoable operation.
- [Range.fillTo Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/fillto-method/llms-full.txt): Range.fillTo method in the TX Sheet Control JavaScript API for the browser, with the return type Range and a JavaScript example.
- [Range.format Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/format-method/llms-full.txt): Range.format method in the TX Sheet Control JavaScript API for the browser: Apply a nested/flat style patch to the whole range.
- [Range.merge Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/merge-method/llms-full.txt): Range.merge method in the TX Sheet Control JavaScript API for the browser: Merge the range; across merges each row separately.
- [Range.read Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/read-method/llms-full.txt): Range.read method in the TX Sheet Control JavaScript API for the browser: Read flat address/text/value/display/style records.
- [Range.rowCount Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/rowcount-property/llms-full.txt): Range.rowCount property in the TX Sheet Control JavaScript API for the browser, with its type number and a JavaScript example.
- [Range.setFormulas Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setformulas-method/llms-full.txt): Range.setFormulas method in the TX Sheet Control JavaScript API for the browser: Write explicit formulas. Includes the syntax and a JavaScript example.
- [Range.setInputs Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setinputs-method/llms-full.txt): Range.setInputs method in the TX Sheet Control JavaScript API for the browser: Write entered-content strings. Includes the syntax and a JavaScript example.
- [Range.setValidation Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setvalidation-method/llms-full.txt): Range.setValidation method in the TX Sheet Control JavaScript API for the browser, with the return type Range and a JavaScript example.
- [Range.setValues Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/setvalues-method/llms-full.txt): Range.setValues method in the TX Sheet Control JavaScript API for the browser: Write a typed matrix of matching dimensions.
- [Range.sheet Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/sheet-property/llms-full.txt): Range.sheet property in the TX Sheet Control JavaScript API for the browser, with its type Worksheet and a JavaScript example.
- [Range.unmerge Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/unmerge-method/llms-full.txt): Range.unmerge method in the TX Sheet Control JavaScript API for the browser: Remove intersecting merges. Includes the syntax and a JavaScript example.
- [Range.values Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/values-property/llms-full.txt): Range.values property in the TX Sheet Control JavaScript API for the browser, with its type CellValue[][] and a JavaScript example.

---

## Nearby

- **Previous:** [parseAddress Function](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/parseaddress-function/llms-full.txt)
- **Next:** [Range.address Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/range/address-property/llms-full.txt)
