Hi, I have built an application using java programming and I want to write MySQL table data to excel sheet by using Apache's POI libraries and MySQL connector in java. I have explored many mobile development blogs for my previous query on Android Programming & get a satisfactory solution. I hope some of the tech experts in this community can help to figure out my issue on java programming.

Re: How to write data from MySql table to Excel using Java? 80 80


In this particular case, personally, I don't use any APIs, I simply generate a csv file which can be opened directy in Excel like any other Excel file.
CSV format is a text format wich means a simple FileWriter can be used without any external APIs.
The generation takes only one loop, the simpliest one whith a :

        String line = resultSet.getXXX(1) + "\t" + resultSet.getXXX(2) + "\t" + ...;

I will other answers about apache's API, I have never used it so I think I will learn something useful.

commented: Excellent suggestion - keep it simple! +15
commented: Cheap, Simple, and Valuable answer. +11
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.