Delete or Remove an entire Row in excel on the basis of some Condition

Hello!!

Can Anyone help me please?
Here is the Excel File
Sample Data.xlsx (10.9 KB)

I want to Delete or Remove a Row from Sheet2 on the Basis of Input Data Sheet.
I have tried to solve this facing error in removing the Row.

@ppr @Palaniyappan @lakshman @Srini84 @Yoichi @kirankumar.mahanthi1 @Nithinkrishna @codemonkee @supermanPunch
Thanks In Advance !!

Hi @Mayank_Soni

Try to use this expression

DtMaster.AsEnumerable.where  (Function(x) x("ColumnNameOrIndex").ToString.Trim.Equals("successful ")).copytodatatable()

After that Use Clear Data Table

Regards
Gokul

Hi @Mayank_Soni ,

Since the schema is same, you could give this a try →

dt2.AsEnumerable().Except(dt1.AsEnumerable(),DataRowComparer.Default).CopyToDataTable()

Where dt1 is the Input and dt2 is sheet2.

Kind Regards,
Ashwin A.K

@Mayank_Soni
the solution given by @ashwin.ashok is a preferred one, as long as Sheet 2 has not to keep remaining Duplicates.

We do use here in the forum the copytodatatable for our suggestions. In case of empty filter results are to expect you can rewrite the query as described here:

[FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum

Hi
Thanks For the Quick Reply
But It is showing “Value Cannot be Null” for Assign. I have tried Input and B2fin Both.
Can You Please Let me know What Output are you getting because I have a confusion that what should I Write in DataTable and in assign.

HI @Mayank_Soni

Look into the sample workflow As @ashwin.ashok suggestion

CompareSheet.xaml (6.0 KB)

Regards
Gokul

Hi @Gokul001
I have Checked the Workflow its working but in my case I have to remove the row on the basis of “Code_” because it is unique and in Input the Row is going to be different every time.
So that’s why I have to assign read cell "B2"and on the basis of that I need to remove the row from sheet2.
I am sharing my Workflow File it will be very helpful if you update it.

Main.xaml (6.9 KB)

Hi @Mayank_Soni

Can you share the expect output also here?

Regards
Gokul

Hi @Gokul001
Expected Output is the same as you have got in Output1.
Though I am sharing the Excel.
Sample Data.xlsx (11.0 KB)
Regards
Mayank

(From d2 in B2fin.AsEnumerable
Where Not dtInput.AsEnumerable.Any(Function (x) x(“Code_”).toString.Trim.Equals(d2(“Code_”).toString.Trim))
Select r=d2).CopyToDataTable

Hi @ppr
Can You Please give me the Updated Workflow with your Linq.
Because I am getting an error that Value cannot be Null.
Main.xaml (7.0 KB)

Regards
Mayank

Had reviewed your implementation.

When ever copy a solution suggestion always check after paste and adopt it to your variable names when needed.

As you had used Read Cell for the instead read range to the sheet2 data it will fail.

Just adopt it like:

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