Remove Duplicate when there is no Duplicate

Hi, Appreciate your advice and help on the below issue:

I am in the middle of Ui Path Course: “Excel Automation with the Modern Experience in Studio”, and one of the issue I encounter is the “remove duplicate” activity.

When the excel file has duplicate lines, this activity can run and save the duplicate-removed file without any issue.

However, when the Excel file does not have a duplicate line (this happens when I re-run my project to fix other issues, and the file is already duplicate-removed from previous runs), it will show the error message: Failed setting the current sheet XXX in the workbook: XXX.

My understanding and I believe the expected the result of “remove duplicate” activity should be: Removing any duplicates where applicable and do nothing when there is no duplicate, certainly not an error message when there is no duplicate.

Appreciate your help on how do fix this i.e. to make it work even when there is no duplicate lines.

My activities:

Error Message:
image

Hi @Vincent_Shoshin

Make sure you have given the correct column name. Because the column name in Excel is Doc. Number and you have given DocNumber.

Check the below image for better understanding

Hope it helps!!

Thanks Parvathy. However the Col Name is not the cause because I already changed the col Name for all my files and the project can run successfully before the duplicated rows are removed. The problem is I can’t run the project when the duplicated rows are already removed.

@Vincent_Shoshin Hi , Can you share the file here?

Hi @Vincent_Shoshin

If possible share your workflow so that we can find out the cause of error.

Regards

Main.xaml (33.0 KB)
Thanks in advance Parvathy. I have attached it.

I just don’t understand why the “remove duplicate” activity is showing the error message when there are no duplicates to remove, instead of saving the file as it is.

@Vincent_Shoshin

In your xaml Copy/Paste Range acitivty is showing me error. As I checked out creating the same workflow it’s working fine.

Regards,

I had no issue with the copy/paste range when I ran. it is just the very early part when removing duplicates as described.

@Vincent_Shoshin

Try copy pasting the column name of DocNumber once again. I didnt have ant issue in Remove Duplicates.\

Regards,

Unfortunately, it did not work.

I just noticed sometimes it does not work and sometimes it does now… I am really confused :sweat_smile:

1 Like

Hi @Vincent_Shoshin

Failed setting to current sheet error is not related to remove duplicates activity.

Basically, remove duplicate activity is trying to perform the actions before the excel is ready for use.

Adding a slight delay inside the excel application scope or adding retry scope to remove duplicates activity might help.

Cheers!

1 Like

Main-Worked on 20231217.xaml (33.0 KB)
thanks @Tuannna1

Hi @Gayathri_Ramanathan , thank you so much It finally worked! I added a delay and the problem disappeared. I was quite frustrated by this haha. Merry Christmas!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.