Hello,
I wrote a code to read the data in an Excel sheet.Its working fine and i want to read the data of other sheet in same excel sheet.and i have to use that on in other function.How to do this?Can any one explain about this.
I would like to use sheet1 data in this function.public static Vector ReadExcel(String fileName) { Vector vectorData = new Vector(); //ReadExcel R = new ReadExcel(); try { FileInputStream fileInputStream = new FileInputStream(fileName); XSSFWorkbook ObjWorkBook = new XSSFWorkbook(fileInputStream); [B]// Read data at sheet 0[/B] [B]I want to read the data for sheet 1..and i have to use that one in other function Like displayDataExcelXLSX[/B]// XSSFSheet ObjSheet = ObjWorkBook.getSheetAt(0); Iterator rowIteration = ObjSheet.rowIterator(); // Looping every row at sheet 0 while (rowIteration.hasNext()) { XSSFRow Row = (XSSFRow) rowIteration.next(); Iterator cellIteration = Row.cellIterator(); Vector CellEachRowData = new Vector(); // Looping every cell in each row at sheet 0 while (cellIteration.hasNext()) { XSSFCell Cell = (XSSFCell) cellIteration.next(); CellEachRowData.addElement(Cell); } vectorData.addElement(CellEachRowData); } } catch (Exception ex) { ex.printStackTrace(); } return vectorData; }
public static void displayDataExcelXLSX(Vector vectorData) { }