I'm using this code to read a whole line in excel, but I want to read only one cell or a string
System.IO.StreamReader file = new System.IO.StreamReader(@"c:\Users\Public\TestFolder\Base.xls");
line = file.ReadLine();
I'm using this code to read a whole line in excel, but I want to read only one cell or a string
System.IO.StreamReader file = new System.IO.StreamReader(@"c:\Users\Public\TestFolder\Base.xls");
line = file.ReadLine();
To access an excel file you can not do it with a StreamReader
since it will not understand the format of the file, you will have to use a library, I would advise that they be based on open xml
like being
ClosedXML - The easy way to OpenXML
To read a cell you would use
var workbook = new XLWorkbook();
var ws = workbook.Worksheets.Add("Cell Values");
string callValue = ws.Cell(2, 2).Value;
Of course I would also advise that you use the excel in xlsx format or in als new versions of excel so it will be compatible with open xml