How to clear all the contents in an excel sheet UiPath

A lot of times while designing process automation we use excels as input or output.

While using excels as a data source we might need to clear all the contents in excel after completing the process execution.

For completing this task there are several ways but we are using vba.

Let’s get into the practical implementation of this task:

Step1: The input in the excel that we are using for this example is shown below:

input excel values

Step2: Drag and Drop an excel application scope activity from activities panel to designer panel as shown below:

excel application scope

Step3: Drag and Drop Invoke VBA activity from activities panel to designer panel as shown below:

clear all the contents

Let’s see the required properties for invoke vba activity:

clear all the contents
  • CodeFilePath – Provide the file path where your VBA code is present.
  • EntryMethodName – Mention the method name that is used in the VBA code.
  • EntryMethodParameters – If you are passing any input values to vba code those can be mentioned here.
  • OutputValue – If the code is returning some value then it can be assigned here.

The VBA code that is used to clear all the contents of an excel file is shown below:

Sub ClearSheet()
End Sub

Here sheet1 is the sheet name where we are clearing the entire data.

This is one way of achieving this task.

Happy Learning!

Like this post then let your friends know about this-:

Leave a Reply

Your email address will not be published. Required fields are marked *