Robert Eriksson Robert Eriksson - 4 months ago 22
HTML Question

How do I create a downloadable excel sheet from an HTML-table?

I have a table in HTML, like this:


I want to download this data in the form of an Excel-sheet. I've tried some "simple" methods of just opening the data in a new window like this:'data:application/,'+document.documentElement.innerHTML);

But the actual table I want to export has too many lines and it crashes the browser..

Any ideas on how to solve this?

Clarification: I want to do this through a webpage, for examble using a button to trigger a function to create the excel sheet and start downloading it. Like this:

<button onclick="downloadExcelSheet()">Download the table as an excel sheet</button>


If this is off of a web server, you want to use the PHP Excel library

It can be found here:

If for some reason you don't have the ability to run PHP scripts, please include more information in your post