Excel Online — Clear range
Excel Online — Clear range
Section titled “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.
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.
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.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
sheet | string | — | Sheet name. |
range | string | — | Range to clear in A1 notation. E.g. A2:Z1000. |
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. / '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. |
Example
Section titled “Example”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 = newDataRelated activities
Section titled “Related activities”- Excel Online — Write range — write after clearing.
- Excel Online — Used range — find out the range to clear.
- Excel Online — Read range — read a range.
- All Excel Online activities