POI读取excel文件

http://poi.apache.org/spreadsheet/

           HSSFWorkbook wb = null;
           POIFSFileSystem fs = null;
           try {
             fs = new POIFSFileSystem(new FileInputStream(ExcelFile));
             wb = new HSSFWorkbook(fs);
           } catch (IOException e) {
             e.printStackTrace();
           }

           HSSFSheet sheet = wb.getSheetAt(0);
           
           Iterator<Row> iterator = sheet.rowIterator();
           iterator.next();
           while(iterator.hasNext()){
               HSSFRow row = (HSSFRow)iterator.next();
               HSSFCell gameCell = row.getCell(0);
               HSSFCell packageCell = row.getCell(1);
               String gameName = gameCell.getStringCellValue(); 
               gameName = gameName.trim();
               String packageName = packageCell.getStringCellValue(); 
               packageName=packageName.trim();  System.out.println(gameName);
         }



你可能感兴趣的:(POI读取excel文件)