1
Reply

Joining excel files

Alan Cox

Alan Cox

Apr 22 2015 10:27 AM
516
Hi,


I am having trouble joining multiple excel files. on a day to day basis i generate multiple reports that all have the same header row. I want to merge all of the excel files into 1 file from a WinForm. 


I want to be able to Select a directory which contains multiple excels, and then click a button that removes the header from all of the files (apart from the first 1) and then joins them all together, so my end result is 1 excel file.


e.g.

a folder on my desktop contains 3 excel files:

File 1 contains 5 rows (including header)
File 2 contains 10 rows (including header)
file 3 contains 2 rows (including header)

when I click the button on my form, i want it to create a new excel document which contains 15 rows (with 1 header row). so it only keeps the header from 1 file.


is anyone able to help me code this? I am completely new with using microsoft.office.interop.excel and just cant work out how to do it.


Many thanks,

AC

Answers (1)