I need some library for .net core to help me create an excel file (no matter the exact file extension).
I tried to use the MICROSOFT.OFFICE.INTEROP.EXCEL.DLL
(windows dll), I searched for it in the nuget gallery, I tried to find other package with core support, but I didnt managed to find one.
Is there a library witch can help me?
You should try EPPlus.Core:
Here is how to read an Excel using that library (tried myself here):
var filePath = @"D:/test.xlsx";
FileInfo file = new FileInfo(filePath);
using (ExcelPackage package = new ExcelPackage(file))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
int rowCount = worksheet.Dimension.Rows;
int ColCount = worksheet.Dimension.Columns;
var rawText = string.Empty;
for (int row = 1; row <= rowCount; row++)
{
for (int col = 1; col <= ColCount; col++)
{
// This is just for demo purposes
rawText += worksheet.Cells[row, col].Value.ToString() + "\t";
}
rawText+="\r\n";
}
_logger.LogInformation(rawText);
}
And at the offictial page I've found a complete example in ASP.Net Core here: https://github.com/VahidN/EPPlus.Core/tree/master/src/EPPlus.Core.SampleWebApp
Juan
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With