Dear All master,
please help to provide a solution.
ThanksCode:Dim stream As FileStream = File.Open("C:\Sample-Sales-Data.xlsx", FileMode.Open, FileAccess.Read) Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateOpenXmlReader(stream) Dim result As DataSet = excelReader.AsDataSet(New ExcelDataSetConfiguration() With { .ConfigureDataTable = Function(underscore) New ExcelDataTableConfiguration() With {.UseHeaderRow = True} }) For Each table As DataTable In result.Tables For Each row As DataRow In table.Rows Dim salesRepName = CType(row("Sales_Rep_Name"), String) If [String].Equals(salesRepName, "Janet") Then Dim year = CType(CType(row("Year"), Double), Integer) Console.WriteLine($"Janet's year is {year}") 'problem this line End If Next Next excelReader.Close() Console.ReadLine()
roy88




Reply With Quote
