How to open an Excel file in C#
The following section explains how to open and read an Excel file through C#.
For open or read an Excel file in C# , first you have to add the Microsoft Excel 12.0 Object Library in you project.
Create a new project and add a Command Button to the Form.
Form the following images you can find how to add Excel reference library in your project.
Select Reference Dialogue from Project menu
Select Microsoft Excel 12.0 Object Library and click OK button
Copy and paste the following source code in your C# project file.
Note : You have to add Microsoft.Office.Interop.Excel to your source code.
using Excel = Microsoft.Office.Interop.Excel;
When you execute the C# source code , it will open the excel file and read the content in the cell A1
- How to create Excel file in C#
- How to read an Excel file in CSharp
- How to format an Excel file using C#
- How to insert a picture in excel from C# App
- How to insert a background picture in excel
- How to create Excel Chart from C#
- How to export excel chart from C#
- How to excel chart in C# picturebox
- C# data validation input box in excel file
- How to read from an Excel file using OLEDB
- How to insert data to Excel file using OLEDB
- How to update data in Excel file using OLEDB
- How to export databse to excel file
- How to export DataGridView to excel file