Here's an example of how to import an Excel file in C# using Microsoft.Office.Interop.Excel:
main.cs536 chars25 lines
This code creates a new instance of the Excel application and opens the specified file. The code then gets the active sheet in the file and loops through each cell in the used range of the sheet, outputting the value of each cell to the console.
Note that you will need to add a reference to the Microsoft.Office.Interop.Excel assembly in your project before you can use this code.
gistlibby LogSnag