poi读取Excel内容数据
public static void main(String[] args) { try{ //获取文件输入流 FileInputStream fileIn = new FileInputStream("D:\\excelfile\\1234.xls"); POIFSFileSystem fs = new POIFSFileSystem(fileIn); //获取Excel文档 HSSFWorkbook wb = new HSSFWorkbook(fs); //获取sheet表格 HSSFSheet sheet = wb.getSheetAt(0); //获取到第一行 HSSFRow row = sheet.getRow(0); //循环获取单元格数据 Iterator<Cell> iterator = row.iterator(); while(iterator.hasNext()){ String value = iterator.next().toString(); System.out.println(value); } fileIn.close(); }catch(Exception e){ e.printStackTrace(); } }