Using xUnit, I can refer to a file, and use a "Select * from [Defined Name]" where Defined Name is the area in the spreadsheet that was highlighted and assigned the Define Names to it. This allows the selection to be treated like a sql dataset.
How can I refer to this selection in IExcelDataReader?
If it doesn't exist, can you make this modification as a suggestion?
Also, I cannot find any reference on how to refer to the data via the column name. You have the following available:
excelReader.IsFirstRowAsColumnNames = true;
However, I cannot seem to find an example on how to reference the column names while looping through the data.
For example:
How can I refer to this selection in IExcelDataReader?
If it doesn't exist, can you make this modification as a suggestion?
Also, I cannot find any reference on how to refer to the data via the column name. You have the following available:
excelReader.IsFirstRowAsColumnNames = true;
However, I cannot seem to find an example on how to reference the column names while looping through the data.
For example:
FileStream stream = File.Open(testFileName, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
excelReader.IsFirstRowAsColumnNames = true;
DataSet testData = excelReader.AsDataSet();
string salesRepName;
while (excelReader.Read())
{
salesRepName = excelReader["SalesRepName"].value;
salesRepId = excelReader["SalesRepId"].value;
}