Delete all content in Excel sheet

Hi All,

I have an excel , on daily basis I need to apply some filter in one of the sheet and remove/delete few entries .

Microsoft office is not installed in VM so can’t use Excel application scope.

How can I achieve this deleting few row and pasting remaining data in same excel sheet
Ex. In sheet there are 100 entry, after reading and applying filter I got 80 entry.

Now I want to paste this 80 entry in back to the same sheet. So that sheet contain only 80 record

Hello @TD_Learner,

Since you can’t use excel application as Microsoft is not installed, you can use workbook read range activity to read the excel file.

Regards,
Jagruti Govindia

Hey @TD_Learner

You can acheive this using Workbook Activities.

Use Filter Activity and Append Datatable.

Attaching Official Documentation of UiPath:

Hope this resolves your issue,
Happy Automation!

Thanks & Regards,
Ajay Mishra

But how can I delete entries in Excel sheet.

ex. In sheet there are 100 entry, after reading and applying filter I got 80 entry.

Now I want to paste this 80 entry in back to the same sheet. So that sheet contain only 80 record

Hello @TD_Learner,

Since you want to want to write the data on the same sheet, either you can delete the file and use write range workbook activity or if you have any formatting you can make a template and every time you run the code you can copy and paste that template in your output folder and by using append range you can generate the output.

Regards,
Jagruti Govindia

Hello @TD_Learner,

Refer the below solution.

Forum_Solution_Excel Workbook.zip (24.8 KB)

Note:: Change your input file paths. And read the annotation for activity’s action guidence.

Hope this will help you.

Regards,
Jagruti Govindia

Hi @TD_Learner ,

Try using the modern activity to clear the contents in the sheet, below is a link to the official documentation,

This would help you to clear the data in the sheet.

Thanks,
Gautham.