This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You've got a number options with Excel. You could export your data using whatever tools your particular database provides (such as DTS with SQL Server or exp with Oracle) in a format you can import into Excel, CSV being the most obvious one. Or you could write some VBA control in Excel to connect to the database and query the data itself. Or if you wanted to do this in Java you'd need to write a program that uses JDBC to get the data and possibly Jakarta POI to create the Excel spreadsheet.