Skip to content

Instantly share code, notes, and snippets.

@riyenas0925
Created February 10, 2019 14:45
Show Gist options
  • Save riyenas0925/c721fe2be466f9b8bf8bd5bd29cbe849 to your computer and use it in GitHub Desktop.
Save riyenas0925/c721fe2be466f9b8bf8bd5bd29cbe849 to your computer and use it in GitHub Desktop.
excel upload
@GetMapping("uploadResult")
public void uploadResult(Integer trackNo,Integer univNo, String savedName , Model model)throws Exception{
List<subjectVO> list =new ArrayList<subjectVO>();
FileInputStream file = new FileInputStream(uploadPath + "\\" + savedName);
HSSFWorkbook workbook = new HSSFWorkbook(file);
HSSFSheet sheet = workbook.getSheetAt(0);
for(int rowindex = 0; rowindex < sheet.getPhysicalNumberOfRows(); rowindex++){
if(rowindex != 0){
HSSFRow row = sheet.getRow(rowindex);
subjectVO vo = new subjectVO();
vo.setCourseNum(row.getCell(2).getStringCellValue());
vo.setCourseTitle(row.getCell(3).getStringCellValue());
vo.setCompletionType(row.getCell(4).getStringCellValue());
list.add(vo);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment