How to add multiple excel files data into single datatable

Hi,

How to add the multiple excel files(same format) data into single data table and that data table has to written in new excel file.

Hi,

You can use Merge Datatable, if both the datatable has same format and same columns then you can use write range and write in new excel file.

1 Like

@RoselinYohan

If its possible you can try this way

dtAll = dtOne.Copy();
dtAll.Merge(dtTwo);

Using assign activity you can do without using merge datatable activity

Thanks,

Pradeep Sridharan

Hi Pradeep & Anil,

I am trying to do same as in the attached images.
I am reading multiple files and want to build a data table for that and has to store all files rows into that table.

last I want to write that in new excel sheet.

Please help me out of this.

Regards,
Roselin

Hi @RoselinYohan,

Where is the error message you are receiving in your workflow.

I think build datatable you can put in the starting of your workflow and before add data row use a for each loop, in array row property of adddatadatarow activity use row.itemarray.

  1. Build Datatable, with same columns as the files.
  2. You are reading all files
  3. For each file, put file in excel application scope.
  4. Read Range for particular excel file
  5. For each row in datatable use add data row to new datatable built using build datatable

Hi Anil,
I tried to do as you suggest.
But still am getting an error in Add Data Row. AM not able to sort it out.

Please find the attached program and suggest me.

Thanks in advance :slight_smile:

Regards,head1.xaml (13.5 KB)


Roselin

Hi @RoselinYohan,

Please refer the below workflow.

The issue with your workflow was you were using same datatable for build datatable and read range and use only one build datatable in the starting.

head1.xaml (12.6 KB)

Thanks a lot Anil.
Provided file is working fine.
Thanks Again :slight_smile:

Regards,
Roselin

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