Look into [url=http://jakarta.apache.org/poi/]POI[/url], which is a Java Library handling Microsoft Office file formats.
Alternatively, you could simply export to a CSV file, which excel can import quite easily (with the added feature that other non-Microsoft Spreadsheets tools can read it as well).