Skip to content

Append Excel Range

Type: excel-append-range  ·  Package: Excel Activities v1.0.6  ·  Output: —

Adds rows immediately below the last row with data on the sheet, starting at column A. Unlike Write Excel Range (which writes at a fixed position you specify), Append works out on its own where the existing data ends and adds right after it — ideal for accumulating data on a sheet over time without overwriting.

It takes a DataTable, a single row as a DataRow or a list of rows (since version 1.0.6) and writes only the cell values, not the row of column names (it adds no header).

  1. It finds the last row with content on the sheet, looking at every column (rows that only have formatting don’t count).
  2. It writes data starting at the next row, always from column A. On an empty sheet, it starts at row 1.
  3. The DataTable is written row by row, without headers (a DataRow, as a single row).
  4. In fast mode, it saves the file; in session mode, the change stays in memory until Excel Save or Excel Close.

If the file or the sheet don’t exist, they are created. Values are written with their type and DBNull leaves the cell empty — see how the data arrives. Accepts session or path — see the two modes.

ParameterTypeDefaultDescription
dataDataTable | DataRow | List<List<object>> | List<object>—The DataTable to add, a DataRow for a single row, a list of rows (arr(arr("a", 1), arr("b", 2))) or a single row as a list (arr("a", 1)). Values are written, without headers. Lists are accepted since version 1.0.6.
ParameterTypeDefaultDescription
sessionZoanExcelSession—Excel Open session (instead of path).
pathstring—Path to the .xlsx (fast mode: opens, saves and closes on its own; created if it doesn’t exist).
sheetstring | int—Sheet name or index; created if it doesn’t exist. If omitted, the first sheet (or "Sheet1" in a new workbook).

This activity does not return a value.

MessageCause and fix
'data' is required.data is empty or the expression returned null.
'data' must be a DataTable, a DataRow, a list of rows (List<List<object>>) or a single row (List<object>).data is something else (for example, a text or a dictionary).
'data' mixes rows (lists) and single values: pass a list of rows or a single row.The list has both rows and single values, like arr(arr("a", 1), "b"). Put each value inside a row.
'session' or 'path' is required.Neither session nor path is set.
The process cannot access the file '…' because it is being used by another process.The file is open in another program when saving. Close it or retry with Retry.

Add the rows of a DataTable at the end of a history file:

Append Excel Range path = "C:/logs/history.xlsx" data = records // a DataTable

Add one row at a time while looping through a table:

For Each items = orders itemVariable = row
└─ activities:
If condition = str(row["Status"]) == "Rejected"
└─ then:
Append Excel Range path = "C:/output/rejected.xlsx" data = row