Skip to content

Excel Online — Clear range

Type: excelonline-clear-range  ·  Package: Excel Online v1.0.4

Clears the contents of a range of cells (leaves the cells empty). Useful to clean an area before writing it again, so nothing is left over from a previous run.

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 and the range in A1 notation (A1:Z100). It clears values and formulas but keeps the formatting (colors, borders, number format), so the template stays ready for new data. The change is saved automatically.

Clearing an already empty range has no effect, so it is safe to repeat. The robot cannot undo a clear; the file’s version history in OneDrive or SharePoint does let you recover the content.

ParameterTypeDefaultDescription
sheetstring—Sheet name.
rangestring—Range to clear in A1 notation. E.g. A2:Z1000.
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. / 'range' 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)range is not a valid A1 address.
Excel Online — Connect credential = credential("m365-finance") path = "Reports/Report.xlsx"
└─ body:
Excel Online — Clear range sheet = "Data" range = "A2:Z1000"
Excel Online — Write range sheet = "Data" range = "A2:C" + (newData.Rows.Count + 1) values = newData