-6

Hi I am trying to get the values of two columns with the column name. I have uploaded an excel sheet and I have to fetch the values of this two columns and then save it in DB. Can someone help me with this

Janani sridhar
  • 23
  • 3
  • 10

1 Answers1

0

Include the latest POI jar

FileInputStream inputStream = ew FileInputStream(" Excel Path ");
Workbook workbook = new XSSFWorkbook(inputStream);
Sheet workSheet = workbook.getSheet(0); // put your sheet number
Iterator<Row> rowIterator = workSheet.iterator();
while (rowIterator.hasNext()) {
    Row nextRow = rowIterator.next();
    Cell cell = nextRow.getCell("col name"); 
    String cellData = cell.getStringCellValue();}