I have imported excel file from angular using formData to web api core 6 C sharp. How can i read each row cell of the excel until i finish them?
Reading Excel Sheet in ASP.NET Core C#
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vishal YelveRank #178 · 13.6K reputationPosted Jul 13, 2024, 12:15 AM EDT
Hi
You can refer my article how to read data from Excel in c#.
https://www.c-sharpcorner.com/article/how-to-read-data-from-an-excel-sheet/
Nikunj SatasiyaRank #302 · 8.3K reputationPosted Jul 14, 2024, 12:56 AM EDT
Hi Austin,
You can take refrence from this article How to Read Excel Sheets in ASP.NET Core C# from Angular | Step-by-Step.
Article LInk:
https://www.codingvila.com/2024/07/how-to-read-excel-sheets-in-aspnet-core.html
Jaimin ShethiyaRank #177 · 13.7K reputationPosted Jul 14, 2024, 6:45 AM EDT
Hello Austin,
Please refer below documantation.
https://github.com/ClosedXML/ClosedXML/wiki
XLWorkbook workbook = new XLWorkbook(FilePath); var rowCount = workbook.Worksheet(1).LastRowUsed().RowNumber(); var columnCount = workbook.Worksheet(1).LastColumnUsed().ColumnNumber(); int column = 1; int row = 1; List ll = new List(); while (row <= rowCount) { while (column <= columnCount) { string title = workbook.Worksheets.Worksheet(1).Cell(row, column).GetString(); ll.Add(title); column++; } row++; column = 1; }Thanks