in reply to Output from CGI script

I've done this by setting the header to application/msexcel and sending the data as a tab-delimited table (I don't know how to build a "real" Excel table).

You might also use text/tab-separated-values in the header and set up your computer to open up Excel (or any other spreadsheet you want to use) for that mime type.

I think I once read that modern versions of Excel can read html tables directly, but as I don't have any version of Excel to test with, I can't confirm ...

Update: actually I like IndyZ's advice...