I have requirement to import Excel file in MySQL database using Java. I Googled it and got the answer is to export CSV files from Excel then import it usingLOAD DATA LOCAL INFILE 'SampleData.csv' INTO TABLE databasetable FIELDS TERMINATED BY ','. It works nicely.
I have doubts why we convert Excel files to CSV then import file into an database. Is there is another technique to import Excel without converting into CSV?
Thanks
CSV is a plaintext file format showing the contents of the Excel file as Comma Separated Values (CSV)
This is done so that the Java program need not know how to parse the Excel Files themselves, which is a big bonus.
Consider the recent change that Office underwent with the Office 2007 release. Their new file format
.xlsxwas not backwards compatible with their former.xlsformat. This is because the.xlsxformat compressed the contents.If your program parsed the
.xlsfiles directly, it would have broken during this changeover. With the CSV conversion, you should be able to read any new Excel format for the foreseeable future.