Skip to content

Excel Online — Read cell

Type: excelonline-read-cell  ·  Package: Excel Online v1.0.4  ·  Output: object

Reads the value of a single cell in a sheet of the workbook.

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.

Give the sheet by name and the cell in A1 notation (B3). If you give a range (B3:C4), only the value of its first cell is returned. If the cell holds a formula, you get the calculated result, not the formula.

It is read-only: it does not modify the workbook.

ParameterTypeDefaultDescription
sheetstring—Sheet name.
cellstring—Cell in A1 notation. E.g. B3.
ParameterTypeDefaultDescription
sessionZoanExcelOnlineSession—Excel Online — Connect session. Inherited inside Connect’s body.

Returns an object with the cell value in its original type:

Cell contentReturned value
Textstring
Numbernumber (integer or decimal)
True / falsebool
DateExcel serial number (e.g. 45458); convert with DateTime.FromOADate(Convert.ToDouble(value))
Emptyempty text ("")

Assign it to a variable; convert it if you need a specific type (Convert.ToDecimal(total)). To check whether the cell is empty, use string.IsNullOrEmpty(Convert.ToString(value)).

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. / 'cell' is required.The parameter is empty or its expression returned null.
itemNotFound (Microsoft Graph, 404)There is no sheet with that name.
InvalidArgument (Microsoft Graph, 400)cell is not a valid A1 address.
Excel Online — Connect credential = credential("m365-finance") path = "Reports/Budget.xlsx"
└─ body:
Excel Online — Read cell sheet = "Summary" cell = "B3" → output: total
If condition = Convert.ToDecimal(total) > 10000
└─ Log message = "The total is over budget: " + total