Spliting datatables

Hi all,

Is there a way to split this excel into 3 seperate datatables?
The final output will be in step 4, which is to get 3 datatables.

  1. Read Range as dtAll in Test Sheet
  2. Count the number of Row.
  3. Get total rows in dt divide by 3
  4. Create 3 new datatables base on result in 3.
    a. dt1 = row2 - 61
    b. dt2 = row 62 - 121
    c. dt3 = 122 to last row.

TestFile.xlsx (43.2 KB)

Thanks for helping out in advance!

Regards
Hidayat

Hi @Md_Hidayat

try this

  1. Read excel file and store in datatable
  2. Assign a int32 variable a = 60
  3. Use the while loop as below condition
    a<dt1.Rows.Count
    Inside the loop do the following
    a. dt_temp = dt1.AsEnumerable().Skip(a).Take(60).CopyToDataTable
    b. Write dt_temp into excel file
    c. Increment a= a+60

Let me know if it works

Thanks & Regards,
Nived N

1 Like

Thanks for the quick reply!

I tried your method. Is it possible to save the into 3 datatables to enable parallel processing?

Regards
Hidayat

Yes,maybe need some little adaptions. But the building Blocks and the main Idea would be the same

Thanks @ppr and @NIVED_NAMBIAR for pointing the correct direction.

Iā€™m able to mix and match both of you guys solutions. :smiley:

Regards
Hidayat

1 Like

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