Excel Online — Append rows
Excel Online — Append rows
Section titled “Excel Online — Append rows”Type: excelonline-append-rows · Package: Excel Online v1.0.4
Adds rows right after the last data in a sheet, without overwriting what is already there. It is ideal for accumulating records (a log, the results of a process…) run after run, without working out where the sheet ends.
How it works
Section titled “How it works”It works on the session created with Excel Online — Connect. Pass it in the session parameter, or place this activity inside the body of Excel Online — Connect to inherit it automatically.
In values you pass a DataTable (or a DataRow for a single row). The activity:
- Asks Microsoft 365 for the sheet’s used range and takes its last row.
- Writes the rows right below, always starting at column A, values only (without the column-name row).
The change is saved automatically. Keep in mind:
- Cells that only have formatting (borders, color) count as used: if there are empty formatted rows at the end, the new rows land below them.
- On a completely empty sheet, Microsoft 365 reports
A1as the used range, so the first appended row lands in row 2. Usually row 1 holds the headers. - With a table that has no rows it writes nothing and does not fail.
- Each call recomputes the last row, so it is not idempotent: if you retry after a failure that did manage to write, the rows end up duplicated. If several robots append to the same sheet at the same time, they can overwrite each other; in that case, use one sheet per robot.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
sheet | string | — | Sheet name. |
values | DataTable | DataRow | — | The DataTable to append (or a DataRow for a single row). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanExcelOnlineSession | — | Excel Online — Connect session. Inherited inside Connect’s body. |
Output
Section titled “Output”This activity does not return a value. The change is saved automatically; the run log states how many rows were appended and in which range.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No Excel Online session available. Provide 'session' from an excelonline-connect activity, or place this activity inside the Connect activity's body so the session is inherited automatically. | The activity is outside Connect’s body and did not receive session. Place it inside the body or pass session = workbook. |
'sheet' is required. / 'values' is required. | The parameter is empty or its expression returned null. |
'values' must be a DataTable (or a single DataRow). | You passed another type (a list or an array). Build the table with Build DataTable. |
itemNotFound (Microsoft Graph, 404) | There is no sheet with that name. |
Example
Section titled “Example”Log the result of each processed invoice:
Build DataTable columns = arr("Date", "Invoice", "Result") rows = arr(arr(DateTime.Now.ToString("yyyy-MM-dd HH:mm"), invoiceNumber, "OK")) → output: recordExcel Online — Connect credential = credential("m365-finance") path = "Reports/Log.xlsx" └─ body: Excel Online — Append rows sheet = "Log" values = recordRelated activities
Section titled “Related activities”- Excel Online — Write sheet — dump from A1.
- Excel Online — Used range — find out where the data ends.
- Excel Online — Read sheet — read the whole sheet.
- All Excel Online activities