I know there are lot of questions of this nature but I need to do this using JavaScript. I am using Dojo 1.8
and have all the attribute info in array, which looks like this:
[["name1", "city_name1", ...]["name2", "city_name2", ...]]
Any idea how I can export this to CSV
on the client side?
Here's an Angular friendly version:
This solution should work with Internet Explorer 10+, Edge, old and new versions of Chrome, FireFox, Safari, ++
The accepted answer won't work with IE and Safari.
Running the code snippet will download the mock data as csv
Credits to dandavis https://stackoverflow.com/a/16377813/1350598
You can use the below piece of code to export array to CSV file using Javascript.
This handles special characters part as well
Here is the link to working jsfiddle
The solution from @Default works perfect on Chrome (thanks a lot for that!) but I had a problem with IE.
Here's a solution (works on IE10):
Based on the answers above I created this function that I have tested on IE 11, Chrome 36 and Firefox 29
For example: https://jsfiddle.net/jossef/m3rrLzk0/