I am trying to upload an excel file to a hosted Blazor webassembly application, for which I am using the following code:
string path= @"D:\Otros\LibrosExcel\ReferenciasDotación.xls";FileInfo fileInfo = new FileInfo(path);ExcelPackage.LicenseContext = LicenseContext.NonCommercial;using (ExcelPackage excelPackage = new OfficeOpenXml.ExcelPackage(fileInfo)){ //loop all worksheets ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.FirstOrDefault(); //loop all rows for (int i = 1; i <= worksheet.Dimension.End.Row; i++) { //loop all columns in a row for (int j = 1; j <= worksheet.Dimension.End.Column; j++) { //add the cell data to the List if (worksheet.Cells[i, j].Value != null) { excelData.Add(worksheet.Cells[i, j].Value.ToString()); } } }}return excelData;but the line of code
ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.FirstOrDefault ();returns null