Remove only a specific duplicate row if found

Hi there,
There’s a new report formatting with duplicated report name and we have to accommodate our automations accordingly as below. Every report will have different range and header start range, so we have to accommodate a standard change dynamically for all reports as we will be using a general workflow with arguments for this. Only 1 row (the duplicate header) should be removed and nothing from the content should be touched
I’m thinking of to read cell A1, and if this value appears again in the report, remove that particular row from Excel. Hence, the goal is to remove the duplicate value that was read from A1 if it’s found anywhere else, else do not remove any other duplicate rows

How can I achieve this easily?

image

@niro

check the above reference

Hello @niro ,

You can use the Remove Duplicates Activity if you want to apply it in Excel.

You could also read the range , save it in a Datatable, and use Remove Duplicate Range Activity. Post which, write it to excel.

hi there, the issue is the range will be different for each report, i can’t specify a specific range, also only 1 row should be removed if the header is found, else no content should be touched

@niro , No problem, read the entire sheet then. Save it in a DataTable. And try to use Remove Duplicate Rows activity

but we do not want to remove the duplicate content of the report, only the duplicate report name header if it’s found

How are you distinguishing the header from the content ? Can you send a better picture of the excel with more columns

@niro

Can you try this way once

dt.AsEnumerable.ToList.FindIndex(Function(a) a(0).tostring.trim.equals(dt.Columns(0).ColumnName))

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