Question posted 2013 · +25 upvotes
I had developed a system that deals with excel sheets in 2006 using MS VS 2005. Now, I can not use the same reference with MS VS 2012.
var app = new Microsoft.Office.Interop.Excel.Application();
Workbooks wbs = app.Workbooks;
Accepted answer +35 upvotes
In your project, right-click on “References” and select “Add Reference”.
VS 2012 / 2013:
Select “Extensions” on the left and look for Microsoft.Office.Interop.Excel.
Note that you can just type “excel” into the search box in the upper-right corner.

VS 2008 / 2010:
Look under the .NET tab.

Excel VBA objects referenced (5)
Application— Using events with the Application objectApplication— Working with Other ApplicationsInterop.Excel— Using events with Excel objectsInterop.Excel— Using Excel worksheet functions in Visual BasicMicrosoft.Office— Controlling One Microsoft Office Application from Another
Top excel Q&A (6)
- Shortcut to Apply a Formula to an Entire Column in Excel +335 (2011)
- How should I escape commas and speech marks in CSV files so they work in Excel? +136 (2012)
- Convert xlsx to csv in linux command line +96 (2012)
- How to create a link inside a cell using EPPlus +50 (2011)
- IF statement: how to leave cell blank if condition is false ("" does not work) +44 (2013)
- T-SQL: Export to new Excel file +44 (2012)
excel solutions on this site
— top 8%.