1.引入 Aspose.Cells
public void test() { HttpFileCollection filelist = HttpContext.Current.Request.Files; if (filelist != null && filelist.Count > 0) { for (int i = 0; i < filelist.Count; i++) { HttpPostedFile file = filelist[i]; var listData = ReadExcelToTable(file.InputStream).Rows; } } } private DataTable ReadExcelToTable(Stream stream) { DataTable result = new DataTable(); Workbook workbook = new Workbook(); workbook.Open(stream); Cells cells = workbook.Worksheets[0].Cells; result = cells.ExportDataTableAsString(0, 0, cells.MaxDataRow + 1, cells.MaxColumn + 1, false); return result; }