I am trying to read a data from an excel table in C #, my code looks like this:
string resp;
string rota= "D:/Users/e608871/documents/visual studio 2010/Projects/CEMIGID/CEMIGID/CEMIGID.xlsx";
var excel = new ExcelQueryFactory(rota);
var res = (from row in excel.Worksheet("Sheet1")
let item = new Program
{
ID = row[0].Cast<string>(),
diretorio = row[1].Cast<string>()
}
select item).ToList();
excel.Dispose();
foreach (var item in res)
{
resp = item.ID;
}
But it does not read, it just opens the console and shows nothing