Skip to content

Write Excel Cell

Type: excel-write-cell  ·  Package: Excel Activities v1.0.6  ·  Output: —

Writes a value to a specific cell. Use it to place a single value: a total in B10, a processing date in A1, a status in a fixed cell. It creates the file if it doesn’t exist.

It writes value to the given cell of the sheet, replacing whatever was there and keeping the cell’s formatting. Accepts session or path — see the two modes.

  • Value type: a number (int, double, decimal), a date (DateTime) or a boolean is stored with its type, so Excel can calculate with it. Any other value is stored as text, including text that looks like a number ("1500"): to write a number, use an expression that returns a number (1500, toNumber(x)).
  • Null value: if value is null, the cell is not modified. To empty a cell, use Clear Excel Range with range = "B3".
  • If the file or the sheet don’t exist, they are created.
  • In fast mode it saves the file on every call; in session mode, on Excel Save or Excel Close.
ParameterTypeDefaultDescription
cellstring—Cell address, e.g. "B3".
valueobject—The value or expression to write.
ParameterTypeDefaultDescription
sessionZoanExcelSession—Excel Open session (instead of path).
pathstring—Path to the .xlsx (created if it doesn’t exist; required if there is no session).
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
'cell' is required.cell is missing.
'session' or 'path' is required.Neither session nor path is set.
'…' is not A1 address or workbook named range.cell is not a valid address (e.g. "1A"). Use the form "B3".
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.
Write Excel Cell path = "C:/output/control.xlsx" sheet = "Log" cell = "A1" value = "Processed"
Write Excel Cell path = "C:/output/control.xlsx" sheet = "Log" cell = "B1" value = now()
Write Excel Cell path = "C:/output/control.xlsx" sheet = "Log" cell = "C1" value = rowCount(invoices)

now() is stored as a date and rowCount(...) as a number, so Excel can format them and calculate with them.