Data table empty after Import Row

datatable
excel

#1

I want to read the excel in chunks and below is the workflow. I have created a while loop to loop in the records in chunks, say 5 records a time. I have used Import Row to add it to another data table, but the table has imported nothing to it. How could this be fixed?

Main.xaml (16.9 KB)


#2

@Sripadraj

Let us take you have a datatable dt1 and you to import rows to datatable dt2

Before using Import row method just assign

dt2=dt1.Clone()

If you want to import rows then the schema of both datatables should be same.
If you use clone it will copy only headers from dt1 to dt2. now the schema will be same for both datatables.

Regards,
Mahesh


#3

Hi @Sripadraj,
its working fine for me.
I am also trying with different flow,
that also working fine.
web_task4.xaml (24.4 KB)

Regards,


#4

Hi Mahesh, Thanks for the hint, but the new data table shows only the last set of data and the previous data is not added to the data table.


#5

@Sripadraj

Sry I didn’t get you , can you explain me in detail.

Regards,
Mahesh


#6

I have an excel of 20 records and I want to read the data in chunks, say 5 records at a time. I want to read each set and add them to another data table. The current workflow add only the last 5 records to the new data table. I want all 20 records to be inserted to another data table. I hope you understood the scenario. :slight_smile:


#7

@Sripadraj
Suppose if you are running a for each row, you have to assign

dt2=dt1.Clone() before foreach row…

before foreach row…

i think you are assigning dt2=dt1.Clone() this inside foreach row, so whenver you do this it will take only headers and delete the data.

Regards,
Mahesh


#8

Hi Mahesh,
I’m sure I have assigned it before the for each loop.


#9

@Sripadraj

can you share the screen shots, for better understanding

Regards,
Mahesh