I want to create a program the let me to select multiple .xls files and marge them into new .xls file using C#. How i can do that ?
Can anyone tell me the steps or guide me to any tutorials help me to do that. please ?!!
Regards,
Fahad Aldaferi
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Alex SmithPosted Nov 27, 2014, 10:56 PM
http://www.c-sharpcorner.com/UploadFile/a08113/solutions-to-merge-multiple-excel-worksheets-into-one/
Constance SwintonPosted Jun 3, 2014, 4:34 AM
Code uses this excel dll written in C#, you can easily adjust the code if you need any custom requirements, for example change the positioning/order of the merged worksheets.
Also check out the following link, it shows some tasks that you can do with ease on your targeted XLS files within a C#.
Sunny SharmaPosted Jul 5, 2013, 1:17 AM
How about fetching data form each selected file into a datatable, merge them all and then write back to an excel file?
Yes, there are few gotchas that you should be aware of. Depending on your file size, it will be covering up your memory, so this will limit the operation until the memory lasts, otherwise would work awesomely. You do have an option to create a temp excel file, open and update it each time you read new excel file and finally save it somewhere on desired location. This would be a little slow. Second thing is, while merging data, you will need to ensure that Headers in all the excel files are same, I mean the data in all the files are consistent to be merged, otherwise you'll have to check every column and read it one by one and then add it to the datatable.
And yes, do follow the link referred by Iftikar, it will let you move on with Coding part.
Hope you got the point.
Cheers!
Iftikar HussainPosted Jul 5, 2013, 1:16 AM
Please check the below link
http://stackoverflow.com/questions/7376964/how-to-merge-two-excel-workbook-into-one-workbook-in-c
Regards,
Iftikar