Click here to Skip to main content
15,918,330 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to merge two excel files in one:
the first file:

ID Name
1 Mary
2 Tom
3 Mai


the second file:
ID Mark
1 89
2 67
3 56

i want the out put is excel file which is like that:
ID Name Mark
1 Mary 89
2 Tom 67
3 Mai 56
how can i do this in c#?
Posted
Comments
Richard C Bishop 10-Sep-13 16:25pm    
Just read both of them and then write the values to the same file you want.

1 solution

If those are *.XLSX files, you can use , you can use Open XML SDK:
http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].

This way, you can support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].

This way, you can work without Office installed. Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

This is another option: http://npoi.codeplex.com/[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900