html to excel Export


I have a table in HTML format.

<table id="table" title="banner" border="1" align="center" > <tr><th>ID</th><th>Name</th><th>Month</th><th>Savings</th></tr> <tr><td>101</td><td>Ramesh</td><td>January</td><td>$100</td></tr> <tr><td>102</td><td>Ram</td><td>Feb</td><td>$200</td></tr> <tr><td>103</td><td>Ramna</td><td>Mar</td><td>$300</td></tr> </table> </body> </html>

I am using Mozilla 3.6 .so how can I export the results to Excel sheet ?


if you mean, as statet by VinayC in one of the comments, to export the generated HTML without having to make another trip to the server, it works just fine with <a href="https://github.com/dcneiner/Downloadify" rel="nofollow">Downloadify</a>.

Description on GitHub:


This library is a tiny JavaScript + Flash library that allows you to generate files on the fly, in the browser, without server interaction. Web applications that allow you to generate vCards, color palettes, custom code, etc would benefit from using this library. In addition to increasing speed (no round trip to the server) this solution can reduce the database and server load of existing web applications. This is not a library to ‘force download’ a file from a server. It does not interact with a server at all.


I am actually using it together with jquery 1.4.4 in our business-environment. I have to display tables with 10k+ rows and about 15 cols which make up for 13.5mb of data.

$('#tbl_purchase_groups_download').downloadify({ 'filename' : 'Purchase_groups.xls', 'data' : html_wrapper_pre + document.getElementById('purchase_groups').innerHTML + html_wrapper_after});

html_wrapper_pre and html_wrapper_after are the opening and closing html-structures with provided encoding.


Why does it have to be MSExcel format?

You can't (easily) get from an HTML page to a local file using javascript. OTOH if the source data is not HTML and you've got a serverside programming language, you can serve up the file in a suitable format - but I'd <strong>very</strong> strongly recommend using text/csv rather than application/vnd.ms-excel

With MSIE you can copy from an html page to the clipboard - but that's an MSIE only function.


You can export a HTML table to Excel using pure JavaScript. Here is a working example: <a href="http://jsfiddle.net/y0jwhnco/1/" rel="nofollow">http://jsfiddle.net/y0jwhnco/1/</a>

var a = document.createElement('a'); var myFileName = 'MyFileName.xls'; a.download = myFileName; a.setAttribute('href', uri + base64(format(template, ctx))); a.appendChild(document.createTextNode(myFileName)); document.getElementById('myTable').appendChild( a);


  • JQuery Mobile 1.4 How to Disable Hover Effect on Mobile Devices
  • Convert adjacency matrix to a csv file
  • Create File Command in Batch Files (*.bat)
  • PDF: How to Optimize Filesize & Convert to PNG (embedded fonts problem)
  • Installing apk from within application in android
  • record audio in HTML / js without Flash?
  • Disabling sound of embedded flash object with html
  • Visualizing a large matrix in matlab
  • back button function for phonegap windows phone 7
  • Can long-polling be achieved in Restlet by just making the thread sleep?
  • Retaining data after updating application
  • what makes a request a new request in asp.net C#
  • SetWindowsHookEx does not react on media keys
  • How do I include a SWC in an AS2 Flash project?
  • Loading .coffee files via a view in Rails
  • System.InvalidCastException: Specified cast is not valid
  • How to suppress a dialog
  • MVC3 Razor - ListBox pre-select not working
  • Read a local file using javascript
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • HTML download movie download link
  • Apache 2.4 and php-fpm does not trigger apache http basic auth for php pages
  • Get object from AWS S3 as a stream
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • Updating server-side rendering client-side
  • How can I estimate amount of memory left with calling System.gc()?
  • WOWZA + RTMP + HTML5 Playback?
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • How to set the response of a form post action to a iframe source?
  • Hits per day in Google Big Query
  • Why joiner is not used after Sequence generator or Update statergy
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Busy indicator not showing up in wpf window [duplicate]
  • UserPrincipal.Current returns apppool on IIS
  • Android Heatmap on canvas or ImageView