devxlogo

Export HTML Table to Excel

Export HTML Table to Excel

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.

Response.ContentType = "application/vnd.ms-excel"
2
3
=SUM(A1:A2)

Don’t include normal HTML, TITLE, HEAD, and BODY tags. They will create a problem.

devx-admin

Share the Post: