I want to transfer data from mysql database to an msexcel sheet...

Is it possible with java. how?

Recommended Answers

All 5 Replies

Google POI and/or Andy Khan's jxl.

Bring your data from mysql db and write to file..

There are 2 ways for writing Excel :

1. Basic Level
Writing CSV(Commma Separated Values) format.
Write your data in simple java file using commas(,) & append extension ".csv" to file name.
eg. file name : companies.csv
data :
1,2,3,4,5
a,b,c,d,e
microsoft,ibm,sun,oracle,apple

This will automatically create excel format file.

2. High Level
Using Apache POI (http://poi.apache.org/)
This is high end Java Library for writing Microsoft Office format files (Word, Excel, Powerpoint etc.)
You can use this library. You will need to read help on the respective site. It supports all types of formatting in excel that one will need.

Bring your data from mysql db and write to file..

There are 2 ways for writing Excel :

1. Basic Level
Writing CSV(Commma Separated Values) format.
Write your data in simple java file using commas(,) & append extension ".csv" to file name.
eg. file name : companies.csv
data :
1,2,3,4,5
a,b,c,d,e
microsoft,ibm,sun,oracle,apple

This will automatically create excel format file.

2. High Level
Using Apache POI (http://poi.apache.org/)
This is high end Java Library for writing Microsoft Office format files (Word, Excel, Powerpoint etc.)
You can use this library. You will need to read help on the respective site. It supports all types of formatting in excel that one will need.

Thaknx a lot.. i'll try & i'l b in touch...

many front ends (such as phpmyadmin) will let you export a table to a csv file, which can be opened directly in excel.

many front ends (such as phpmyadmin) will let you export a table to a csv file, which can be opened directly in excel.

:icon_lol:

Be a part of the DaniWeb community

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