How to read an Excel file in C#
From the following section you can see How to find the last row data in Excel worksheet or How to find the Used area in an Excel worksheet from C#.
The following C# source code using Microsoft Excel 12.0 Object Library for reading an Excel file. In the previous section we saw how to import Microsoft Excel 12.0 Object Library in the CSharp project .
How to specify a range in Excel sheet?
If you want to select a specific cell in Excel sheet, you can code like this.
If you want to select multiple cell value from Excel sheet, you can code like this.
For reading entire content of an Excel file in C#, we have to know how many cells used in the Excel file. In order to find the used range we use "UsedRange" property of xlWorkSheet . It will return the last cell of used area.
Excel.Range range ;
range = xlWorkSheet.UsedRange;
When you execute this C# source code the program read all used cells from Excel file.
- How to create Excel file in C#
- How to open an Excel file in C#
- 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