Here is a simple way to export an HTML table to Excel with a single line of code. For the technique to work, you must have Excel installed on the your machine.
Copy the following code and paste it in notepad. Save it as an ASP page, and then open it in the browser to see the action live.
<% The main feature of this technique is that %>
<% you have to change Content type to ms-excel.%>
Response.ContentType = "application/vnd.ms-excel"
Don't include normal HTML, TITLE, HEAD, and BODY tags. They will create a problem.