How to write or append bulk data in existing workbook?

It’s only in data table

In below

When I’m using exact code what u sent it den this exception occuring

@Anil_G

Cheers

@suraj_gaikwad

Please write full code …it might not show but if you write copytodatatable and it would work…copy the code properly or write full code

You would have changed datatatyep now…as per previous error it is clear that left is array and right is the expression…changing left to datatable will fix

Cheers

@Anil_G

It’s work, but as per condition not getting correct output (Confirmed) cases

And when I’m using last code it’s getting correct output in for each loop but it’s taking time to append data

Thanks

@suraj_gaikwad

Can you explain the conditions you need so that can give the correct code

Cheers

Again DOC-20231016-WA0016.xlsx (8.5 KB)

In above excel sheet column name is (“Match Type”) and there is two condition 1.Probable 2.Confirmed

I need to delete that confirmed cases for exp

Customer name. Case Id. MATCH TYPE

1.Suraj gaikwad 1. Probable
2.suraj gaikwad 2. Probable
3.Suraj gaikwad. 3. CONFIRMED
4.Rajesh sharma. 4. probable
4Rajesh sharma. 4. PROBABLE

in above example

I need that data which are only Probable fo all cases
Like Rajesh Sharma is probable case

And suraj gaikwad that all data should be deleted because there one confirmed case

Point :- Which I shared the at the starting that code is working but I have to use loop den if condition

One more we can implement logic by using case id also bcz the case id are same for different names

It’s taking lots of time bcz of huge data is there so I need to be fast append

@Anil_G

Thanks

@suraj_gaikwad

Please try this

Dt.AsEnumerable.GroupBy(function(x) x("Customer Name").ToString.ToLower.Trim).Where(function(x) Not x.Any(function(y) y("Match Type").ToString.ToLower.Trim.Equals("confirmed"))).SelectMany(function(x) x).CopyToDatatable

Using the above you will get only cases where the match type is not confirmed at all…any group having atleast one match type as confirmed will be removed

Cheers

Hi @suraj_gaikwad ,

Is it possible for you to share this code, so that we can correct the code or design, Looks like the problem is in the Design or using Multiple Excel Scopes (Within For Each Row).

@Anil_G

Code is working but giving an error (The source contains no data rows) if data found

@supermanPunch

I can’t sahre file bcz of confidential

Thanks

@suraj_gaikwad ,

For this Error, it is understood and we have the below post which has the method to handle the error :

@supermanPunch I had use of condition so it’s working

@suraj_gaikwad

Does all combinations have confirmed in the data?

If so…then that error might come

To mitigate we can first check the count and then copy

Can you please confirm the same

Cheers

@Anil_G

The code is proper working,

I used if condition if the rows founds it write.

Now how to append huge data fast

Thanks

@suraj_gaikwad

Where is append again?

Already all data is coming as one datatable

Cheers

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