on-internet
← Community

Find a specific string in an Excel file using Apache POI API

Stack Overflow ·

I'm new to Apache POI API for reading MS Office documents, but good at Java. I want to search a specific string from an Excel File. I'm doing in this way: private void processExcelFile(File f_path) throws Exception{ File path=f_path; try{ FileInputStream is=new FileInputStream(path); HSSFWorkbook wb = new HSSFWorkbook(is); HSSFSheet sheet = wb.getSheetAt(0); int rowcount_post=0; int rowcount_304=0; for(Row row: sheet){ for(Cell cell : row){ if (cell.getCellType() == Cell.CELL_TYPE_STRING){ if (cell.getRichStringCellValue().getString().trim().equals("GET")){ rowcount_post=row.getRowNum(); HSSFR

Comments

Sign in or sign up to comment and upvote.

No comments yet.