Append range is adding too much

Hi, I have a strange problem that I can’t find a solution for. I am reading from an Excel sheet and using a “For each” activity entering a value into a website for data scraping. The results are read into a data table. All very standard and working fine.

Then the robot is reading the scraping output datatable and enter the values into an Excel sheet. Then the robot run a VBA code to filter the values. (Too complex for the filter table activity). Everything good so far. Then the result after running the VBA code is read using a “Read range” activity, and written into a different sheet using the Append range activity. All very standard, but this is where something goes wrong.

When the robot appends the values, every time the robot do a “For each loop” it writes in the new value, but also keep the past values. What can cause this?

Please have a look at the attached screenshot that show an example outcome of the append activitiy. The values with green background should be there, the red ones should not.Example

Well off course it does. You have to clear the DT you are appending after every append.

Yes, I am aware of that, and I am clearing it. That is the strange thing. So I was thinking the problem is in Excel, not UIPath. I have also tried “Write range” and a counter. Same thing

Hardly. Can you provide the code or a screenshot

Here are screenshots, starting directly after data extraction.

I have been able to “improve” it a little bit. But it is now writing in the data starting on row 31, next on row 54, without any logic in it

Instead of append range activity use write range activity as append range will keep the already existing records in the excel while write range will over write it
And also use CLEAR DATATABLE Activity before inserting new value to that datatable

Cheers @wwls

OK, thank you very much for your time and sharing your knowledge!

1 Like

Kindly let know for any queries or clarification
Cheers @wwls