A lot of GUI applications will allow you to cut and paste data into Excel but from a programmatic standpoint, its best to write a
java program that converts the result set into a CSV file (just fields separated by commas) and import that into excel.
You could also try GUI tools for exporting your database directly into a CSV file.