Question

I am trying to pull an entire row of values off of an excel file using linq to excel. I have all of the column names (there's 104 different ones) and now I just need to get the one row of values associated with each header. What I would like to do is just pull the entire second row of values, but I haven't been able to figure a work around for that.

Does anyone know of a way to just pull one row? Or do I need to approach this differently and pull the individual value by the header name.

Thank you.

Était-ce utile?

La solution

Use the LinqToExcel.Row class (Documentation)

var excel = new ExcelQueryFactory("excelFileName");
var firstRow = excel.Worksheet().First();
var companyName = firstRow["CompanyName"];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top