Excel operations are most commonly used for export and import.
This example uses NPOI ....
DataTable dts = IWorkbook workbook = ISheet sheet = IRow headerRow = sheet. createRow (DataColumn column headerRow. createCell (column. ordinal ). setCellValue (column. caption); rowIndex = (DataRow row IRow dataRow = (DataColumn column rowIndex ++ filepath = Server. mapPath () + FileStream file = ExcelHelper. downLoad (SuccessMsg is not enabled (DownLoad (FileInfo fileInfo = FileStream fs = [] bytes = [(fs. read (bytes, HttpContext. current. response. contentType = HttpContext. current. response. addHeader (, +}
The above is the export. Next I will introduce the import.
path = HttpContext.Current.Server.MapPath( file.SaveAs(path + FileStream sw = File.Open(path + IWorkbook workbook = ISheet sheet1 = workbook.GetSheet( rowsCount = IRow firstRow = sheet1.GetRow( !(firstRow.GetCell().ToString() == && firstRow.GetCell().ToString() == && firstRow.GetCell().ToString() == && firstRow.GetCell().ToString() == && firstRow.GetCell().ToString() == ( i = ; i < rowsCount; i++ IRow row = Shop_Product product = category = row.GetCell() != ? row.GetCell().ToString() : (! cate = _unitOfWork.Shop_ProductCategoryRepository().GetAll().FirstOrDefault(t => t.Name == (cate != product.ProductCategoryName = product.Shop_ProductCategory_ID = product.PName = row.GetCell() != ? row.GetCell().ToString() : product.PCName = row.GetCell() != ? row.GetCell().ToString() : (row.GetCell() != product.Price = Double.Parse(row.GetCell( product.Description = row.GetCell() != ? row.GetCell().ToString() : }