Uploaded Excel file Is In HttpPostedFileBase object
HttpPostedFileBase hpf = Request.Files["ExcelFileeUploader"];
Want To Read Excel Data From This Object. thanks.
If you use EPPlus, it's as simple as this:
public void ImportExcelXls(HttpPostedFileBase fileBase)
{
using (var package = new ExcelPackage(fileBase.InputStream))
{
// get the first worksheet in the workbook
ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
int col = 1;
for (int row = 1; worksheet.Cells[row, col].Value != null; row++)
{
// do something with worksheet.Cells[row, col].Value
}
} // the using
}
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