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.

<% The main feature of this technique is that %><% you have to change Content type to ms-excel.%>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.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist