Theurl variable contain the url (' ie = Dispatch('InternetExplorer.Application') Python code that open the ie window and has access to it: The conversion has to be done on client side Header('Content-Disposition: attachment filename=''.basename($fname).''') Header('Content-Type: application/vnd.ms-excel') This is a php but you maybe able to change it to javascript: You may also need to perform base64 encoding on the data URI content, which may require a js library, as well as adding the string ' base64' after the mime type in the data URI. It is worth noting that older browsers do not support the data URI scheme, so you may need to produce the file server side for those browser that do not support it. Window.open('data:application/vnd.ms-excel,'+worksheet) This is all the code that's required: $(document).ready( function () ', row_data) You get a grid that sorts, filters, orders, and pages your data, and with just a few extra lines of code and two small files included, you get export to Excel, PDF, CSV, to clipboard and to the printer.
Far and away, the cleanest, easiest export from tables to Excel is Jquery DataTables Table Tools plugin.