I would open a spreadsheet using the COM COM library. If you add a link to the Microsoft Excel object library, you can go to the Com interface.
Add these statements:
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.Excel;
Then you can read from the spreadsheet by doing something like this:
private void GetData(string fileName, string tabName)
{
Workbook theWorkbook;
Application ExcelObj = null;
ExcelObj = new Application();
theWorkbook = ExcelObj.Workbooks.Open(fileName,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
Sheets sheets = theWorkbook.Worksheets;
Worksheet worksheet = (Worksheet)sheets[tabName];
Range range = worksheet.get_Range("A1:A1", Type.Missing);
string data = range.Text as string;
theWorkbook.Close(false, fileName, null);
}
This code will read the contents of cell A1 into a string.
COM Excel , , . , , , .
/ .
ODBC Excel, . 1. COM-.
, DataSet. DataGridView, WinForms ListBox WPF. XML, DataSet WriteXml .