Excel Online — Write sheet
Excel Online — Write sheet
Section titled “Excel Online — Write sheet”Type: excelonline-write-sheet · Package: Excel Online v1.0.4
Dumps a dataset to the sheet starting at A1, computing the range for you. It is the easiest way to write a whole table without giving a target range.
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); only the row values are written. The range is computed from the data size: a table with 50 rows and 4 columns is written to A1:D50. The change is saved automatically.
Details to keep in mind:
- It does not write the column-name row: the first row of the table lands in
A1. If the sheet must have headers, keep them in row 1 and write the data with Write range fromA2, or with Append rows. - It only overwrites the area the data covers: anything outside it (extra rows from a previous run, other columns) stays. To replace everything, clear first with Clear range.
- Null cells (
DBNull) are left untouched and keep whatever was there. - With a table that has no rows it writes nothing and does not fail.
- The sheet must exist; this activity does not create it.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
sheet | string | — | Sheet name. |
values | DataTable | DataRow | — | The DataTable to write (or a DataRow for a single row); values only. |
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.
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, an array, a text). |
itemNotFound (Microsoft Graph, 404) | There is no sheet with that name. Create it in the workbook before running the process. |
Example
Section titled “Example”Excel Online — Connect credential = credential("m365-finance") path = "Reports/Output.xlsx" └─ body: Excel Online — Read sheet sheet = "Source" → output: data Excel Online — Clear range sheet = "Copy" range = "A1:Z5000" Excel Online — Write sheet sheet = "Copy" values = dataReading without has-headers brings the source sheet’s header row in as the first data row, so the copy is identical, headers included.
Related activities
Section titled “Related activities”- Excel Online — Write range — write to a specific range.
- Excel Online — Append rows — add rows at the end.
- Excel Online — Read sheet — read the whole sheet.
- All Excel Online activities