tags:

views:

43

answers:

1

i need code in C# to open my excel sheet which contain list of students names ,and open CSV file contain two columns name of same student in excel sheet, and marks of student ... by click on button i want to match between the names and put in the excel sheet every name with his mark. That's all just find names and marks from CSV and put it on next cell of name in excel sheet

+1  A: 

Reading from the Excel file:

http://stackoverflow.com/questions/15828/reading-excel-files-from-c

Reading from the CSV file:

http://www.switchonthecode.com/tutorials/building-a-simple-csv-parser-in-csharp

(Google for more)

You'll want to tweak the final output of this stuff, of course, so they can be easily compared and manipulated against one another.

Writing to the Excel file may be a little trickier. You may end up having to use the COM library for it:

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ef11a193-54f3-407b-9374-9f5770fd9fd7

But, depending on your needs, you may be able to get away with something simpler:

http://www.codeproject.com/KB/cs/WriteDataToExcel.aspx

David
You can write with ADO.Net as well - http://www.msnetprogrammer.net/blog/post/2008/02/07/Reading-Writing-to-Excel-Worksheet-ADONET2c-C.aspx
Mikael Svenson
Sweet, I didn't know that. Noted for future development at my job, thanks!
David