Skip to content

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.

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 from A2, 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.
ParameterTypeDefaultDescription
sheetstring—Sheet name.
valuesDataTable | DataRow—The DataTable to write (or a DataRow for a single row); values only.
ParameterTypeDefaultDescription
sessionZoanExcelOnlineSession—Excel Online — Connect session. Inherited inside Connect’s body.

This activity does not return a value. The change is saved automatically.

MessageCause 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.
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 = data

Reading without has-headers brings the source sheet’s header row in as the first data row, so the copy is identical, headers included.