# DashboardAnalytics.setData Method

> DashboardAnalytics.setData method in the browser JavaScript API: Replaces a connector source's transient snapshot atomically after validation.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > JavaScript API > Browser Editor > DashboardAnalytics > DashboardAnalytics.setData Method
- **563 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboardanalytics/setdata-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboardanalytics/setdata-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboardanalytics/setdata-method/llms-full.txt

---

Replaces a connector source's transient snapshot atomically after validation. Rows are detached, bounded to 250,000 cells and cleared on document replacement. Existing queries, joins and widgets use the same field IDs as worksheet sources.

Owner: [DashboardAnalytics](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboardanalytics/llms-full.txt). Package: `@txtextcontrol/tx-sheet-control`. Version: **2.0.0**.

### Syntax

```javascript
owner.setData(sourceId, data)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `sourceId` | `string` | No | Value matching sourceId's declared type and the owning object's validation rules. |
| `data` | `AnalyticsData` | No | Application-supplied data matching the documented schema. |

### Return Value

`void`.

### Examples

Use a fresh sample workbook for this example. In the browser pass editor.workbook; in Node.js pass the server control. Document-bound objects are obtained from that same owner.

```javascript
function supplySalesSnapshot(book) {
    book.analytics.setSource({
        id: 'imported-sales',
        name: 'Imported sales',
        connectionId: 'sales-service',
        queryId: 'regional-sales',
    });

    book.analytics.setData('imported-sales', {
        columns: ['Region', 'Revenue'],
        rows: [
            ['North', 42000],
            ['South', 38500],
        ],
    });
}
```

### Remarks

Use this member on an object from the current document. Reacquire document-bound handles after replacement/deletion. Validate arguments against the declared types and documented bounds; handle exceptions or rejected promises.

### See Also

- [DashboardAnalytics Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboardanalytics/llms-full.txt)
- [Creating Dashboards](https://docs.textcontrol.com/tx-sheet-control/dashboards/creating/llms-full.txt)
- [AnalyticsData Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/analyticsdata/llms-full.txt)

---

## Nearby

- **Previous:** [DashboardAnalytics.removeSource Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboardanalytics/removesource-method/llms-full.txt)
- **Next:** [DashboardAnalytics.setRelationship Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboardanalytics/setrelationship-method/llms-full.txt)
