i have a two different excel sheets ,here i need to do, first take any row value from excel sheet 1 and search the value which we picked in excel1 in to another excel sheet . if value is there in excel 2, ok no issue …if value is not there we need to through exception. this is the scenario …please any one help me on this.
already i have tried that example for my scenario but i couldn’t able to get the success message . Please if you have any other example could you please post me.
where dt1 is datatable from Excel1 and dt2 is from Excel2
ForEach row In dt1 If dt2.Select("[columnname2] = "+row.Item(“columnname1”).ToString)).Count > 0 Then … //do actions here
So in other words, you loop through each row, and filter the second table using that value. If it finds any rows with that value, the .Count will be > 0 and become true. If it doesn’t find anything then the .Count will be Zero.
Thanks for your response i am trying like as you said but didn’t get the flow …if you dont mind can you please post me the flow of solution please help me.
You can fetch the unmatched rows in one line code. I hope this is similar to your requirement. Not necessary that you need to use it as it could be a bit confusing.
Scenario is fetch the tags data from excel1 column and find in excel2 in Controller column only.
Datatable Final_result = (From x In dt1.AsEnumerable() where (From a In dt1.AsEnumerable() Join b In dt2.AsEnumerable() On a(“Controller”).ToString() Equals b(“Critical tags”).ToString() select a).Contains(x) select x).CopyToDataTable()
If there is a blank cell in any of the column and email should be triggered.
If there is an duplicate row( The entire row should be a duplicate ) an email should be triggered.
testfile.xlsx1 (199.1 KB)testfile.xlsx (199.1 KB)
Hi @aksh1yadav,
Can you please help me in understanding this equation:
Datatable Final_result = (From x In dt1.AsEnumerable() where (From a In dt1.AsEnumerable() Join b In dt2.AsEnumerable() On a(“Controller”).ToString() Equals b(“Critical tags”).ToString() select a).Contains(x) select x).CopyToDataTable()
Hi I used this for comparing two data table. But when both data tables are same, it throws an error as ‘the source contains no data rows’. could you please help in resolving this.
In_DataTable1.AsEnumerable().Where(function(row) In_DataTable2.AsEnumerable().Select(function(r) r.Field(Of variable type i.e string)(In_DT1_ColName_To_Match.ToString)).Any(function(x) x = row.Field(Of variable type i.e string)(In_DT1_ColName_To_Match.ToString))).CopyToDataTable
Hi all,
I have two different datatables of different size.I have to check the all values of single column from one datatable in another column of second datatable.If that value is present I have to get the corresponding value from that same row and replace the value in my first datatable of another column.So basically I can put my scenario in this way.
datatable1: datatable2:
Id(column1) status(column2) id (column1) status(column2)
1 open 1 close
2 close 3 close
3 open 5 open
In the above scenario i have to search whether all the ids from column 1 of datatable is present in column 1 of second data if id is present i have to replace the value of status of column 1 with the value of status from datatable2
I have 2 Excels and each excel contains 9 sheets of same sheetnames and column names …Now i need to compare the values in Both the excels corresponding to their respective column names and if the values are same them …it should write as “samevalue” in the 3rd excel and if not it should print as "values are different " . Can anyone help me with the query .
As i have 9 sheets in each excel to compare , I don’t understand whether i need to go for multiple looping statements for comparision .Please suggest me an other way as it is not working for my req criteria.