Accepted answer

you can't :p

javascript doesn't know anything about excel a closed source desktop application however it does know csv which is basically a string but im not sure if you can trigger a download with javascript what you need in this case is a server-side language like php

so what i would do is - a high level list -

  1. identify the row i want to export by attaching an event handler
  2. make an ajax call to the 'backend' sending the id of the model and possibly the db table name or any other parameters that will help you get the model
  3. handle that ajax call with php

    3.1 make a database call requesting the whole model of that id

    3.2 use some third-party library that creates excel files

    3.3 trigger a download prompt

alternative step 2.

if you already have the model in json or as a javascript object you can serialize it and make an ajax call to the 'backend' and send it instead that would save you the db call and then you would unserialize in php and continue with step 3.2

it would really helpful if you could post link from the highcharts website with the type of the chart you are using e.g. is it a pie chart or a bar chart etc

maybe you can trigger a download with javascript after all but only on html5 compatible browsers create a file in memory for user to download, not through server


you can try to use one of users plugin to export data to excel:


then you can use phpexcel. it is an easy utility for exporting your data to excel

Related Query

More Query from same tag