How to read excel file using spring boot

后端 未结 4 1149
北恋
北恋 2021-02-02 00:46

I am making a spring boot application which will take the excel file and store its content and store it in database. I have tried many ways..but not successful. Is anyone has id

4条回答
  •  半阙折子戏
    2021-02-02 01:18

    Works for me

        
        @PostMapping("/import")
        public void mapReapExcelDatatoDB(@RequestParam("file") MultipartFile reapExcelDataFile) throws IOException {
    
           List tempStudentList = new ArrayList();
            XSSFWorkbook workbook = new XSSFWorkbook(reapExcelDataFile.getInputStream());
            XSSFSheet worksheet = workbook.getSheetAt(0);
    
            for(int i=1;i

提交回复
热议问题