Delete Specific Rows in Excel Containing particular String

Hey Everyone,
I am facing another problem here.

I have a Excel Sheet (Sheet 1), where Entries are made in random fashion.
For Example : First Entry can be made for A10007 and next entry can be for A10018.

Now,I filter this Sheet to get only those rows containing where entries are done and paste in another Sheet (Sheet 2), then do the needed operations.

Sheet 2 Looks something like this.

After the operations are done from Sheet 2, I want to delete those rows from Sheet 1, where entries are done.

Expected Output in Sheet 1, where Rows *A10001 and A10008
have been removed.

Please Assist.
@lakshman , @Palaniyappan @Suman7

2 Likes

HI
Did we try with linq query like this once after getting the datatable from both the excel files

dt_NonMatched_Data = In_DataTable1.AsEnumerable().Where(function(row) Not In_DataTable2.AsEnumerable().Select(function(a) r.Field(Of String)(In_DT2_ColName_To_Match.ToString)).Any(function(x) x = row.Field(Of String)(In_DT1_ColName_To_Match.ToString))).CopyToDataTable()

Cheers @Aditya_Bhalerao

Hi @Aditya_Bhalerao,

Download the package Version 15.0.0 Here

Find - It finds text inside excel and return the cell info as array and row index as array

Delete Rows - It deletes contiguous Rows inside excel sheet.

If you don’t know the range, leave it with double quotes. It will use the used range.

Regards
Balamurugan.S

@Palaniyappan

Can you please share a workflow file representing what you mentioned.

1 Like

Hi Aditya,

For fetching the uncommon rows of the two data tables, we can use the below method :

DT_UnCommonRows = DT1.AsEnumerable().Except(DT2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

Please find the xaml and sample excel files attached. Here Sheet3 contain the result where it have the Sheet1 data excluding the Sheet2 data.
Main.xaml (6.8 KB) Test.xlsx (9.3 KB)

Regards,
Suman