Skip to content

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 valuesnot 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.

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.

ParameterEditorDescription
dataexpressionThe DataTable to write (or a DataRow for a single row). Writes the values, not the headers.
startCellexpressionTop left cell where to start, e.g. "B2".
ParameterEditorDescription
sessionexpressionExcel Open session (instead of path).
pathexpressionPath to .xlsx (created if it does not exist; required if there is no session).
sheetexpressionName or index of the sheet. By default, the first /"Sheet1".

Dump a DataTable starting at a specific cell of a template:

Excel Open path = = asset("template.xlsx") → output: book
Write Excel Range session = = book startCell = "B5" data = = sales // a DataTable obtained earlier
Write Excel Cell session = = book cell = "C2" value = = "Report " + month
Excel Save session = = book savePath = = "C:/reports/" + month + ".xlsx"
Excel Close session = = book