0

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

John Saunders
  • 160,644
  • 26
  • 247
  • 397
karim
  • 1
  • 1

1 Answers1

1

Reading from the Excel file:

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

Community
  • 1
  • 1
David
  • 208,112
  • 36
  • 198
  • 279
  • 1
    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 Jul 12 '10 at 19:16
  • Sweet, I didn't know that. Noted for future development at my job, thanks! – David Jul 12 '10 at 19:18