Write Excel Range
Write Excel Range
Section titled “Write Excel Range”Type: excel-write-range · Package: Excel Activities v1.0.0
Writes values to the sheet from a specific cell, without treating any row as a header. Takes a DataTable (or a single row as a DataRow) and writes its data values —not the column names. Use it when you want to place data in an exact position—for example, filling out an Excel template that already has its own formatting and titles.
It is almost identical to Append Excel Range; the only difference is where it writes: Write Range, in the cell you indicate (startCell); Append Range, automatically below existing data.
How it works
Section titled “How it works”Place the data values on the sheet starting at startCell and extending down and to the right. Does not clear the sheet or write headers: it overwrites only the cells it occupies. Accepts session or path — see the two modes.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
data | expression | The DataTable to write (or a DataRow for a single row). Writes the values, not the headers. |
startCell | expression | Top left cell where to start, e.g. "B2". |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
session | expression | Excel Open session (instead of path). |
path | expression | Path to .xlsx (created if it does not exist; required if there is no session). |
sheet | expression | Name or index of the sheet. By default, the first /"Sheet1". |
Example
Section titled “Example”Dump a DataTable starting at a specific cell of a template:
Excel Open path = = asset("template.xlsx") → output: bookWrite Excel Range session = = book startCell = "B5" data = = sales // a DataTable obtained earlierWrite Excel Cell session = = book cell = "C2" value = = "Report " + monthExcel Save session = = book savePath = = "C:/reports/" + month + ".xlsx"Excel Close session = = bookRelated activities
Section titled “Related activities”- Write Excel Sheet — write a DataTable with headers.
- Write Excel Cell — write a single cell.
- Read Excel Range — read raw values.