0

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

0

2 Answers 2

3

Try Apache POI.

http://poi.apache.org/

More info on why POI is possibly better than JExcel and other alternatives:

Which is better open source for Excel file parsing in Java?

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for quick reply but i have different question "why we need to convert excel file into csv before import it into database?"
See Peaches491's answer. However, in case you were saying I was answering the wrong question, from your original question: "Is there is another technique to import excel without converting into csv." That is what I answered.
2

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 .xlsx was not backwards compatible with their former .xls format. This is because the .xlsx format compressed the contents.

If your program parsed the .xls files 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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.