目前网上能找到的读取Excel表格中数据的两种比较好的方案:PageOffice好用开发效率高;POI免费。供大家参考,针对具体情况选择具体方案。
1. PageOffice读取excel
import com.zhuozhengsoft.pageoffice.*; import com.zhuozhengsoft.pageoffice.excelreader.*; //读取Excel单元格数据 Workbook workBook = new Workbook(request, response); Sheet sheet = workBook.openSheet("Sheet1"); Table table = sheet.openTable("A1:F5");while (!table.getEOF()) { //获取提交的数值 if (!table.getDataFields().getIsEmpty()) { for(int i=0; i<6; i++){ String content = table.getDataFields().get(i).getText(); System.out.println(content);//输出单元格数据 } } //循环进入下一行 table.nextRow(); } table.close(); workBook.close();