import .xls files to mysql in java servlet
I have a folder of 300+ xls files. The structure of this files is the same, but data is different. So I need to import this data to mysql table using servlets. I think there are few stages:
- Loa开发者_StackOverflow社区d a folder with files to server
- Convert files to .csv
- Import files one by one to mysql
But how can I implement this mechanism technically using servlets?
Thanks
First convert Xls to csv using this:
http://permalink.gmane.org/gmane.comp.jakarta.poi.user/14301
Then Import the csv using this:
http://www.javalobby.org/java/forums/t53674.html
using apache poi you can easily read any number of xls file. link :http://poi.apache.org/ To insert it into database it is not required to convert it into .csv. You can read each cell of each file .Since each file's structure is same a List of DTO formed by storing all value of you excel sheet can be directly inserted into database. You can get started at http://poi.apache.org/spreadsheet/quick-guide.html
Best of Luck
精彩评论