-1
Symbol: AAPL,Company: ABC ,Price: 132.54 (nextline)
Symbol: SDF,Company: ZX Corp,Price: 132.54(nextline)
Hassan Imam
  • 21,956
  • 5
  • 41
  • 51
  • Have you checked https://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side – Leone Feb 08 '18 at 05:55

1 Answers1

0

You can use the following

var data = "data:text/csv;charset=utf-8,name1,city1,some other infoname2,city2,more info"

var data = "data:text/csv;charset=utf-8,name1,city1,some other infoname2,city2,more info";

var encodedUri = encodeURI(data);
<a href="file" download="file.scv">Download</>

You should have the above data in the variable to convert it to CSV once you have the data in the variable you can do the following.

var encodedUri = encodeURI(data);
window.open(encodedUri);
Bhavesh Shah
  • 51
  • 1
  • 7