export-to-csv

Export to CSV using jQuery and html

大憨熊 提交于 2019-11-26 00:32:26
问题 I have a tabular data which I need to export to csv without using any external plugin or api. I used the window.open method passing the mime types but faced issues like below: How to determine whether Microsoft Excel or Open Office is installed on the system using jquery The code should be independent of the fact that what is being installed on the system i.e., openoffice or ms excel. I believe CSV is the format which can be expected to show in both the editors. CODE <html> <head> <script src

Export javascript data to CSV file without server interaction

房东的猫 提交于 2019-11-26 00:25:38
If we were on a nodeJS server, we could write a header, set a mime type, and send it: res.header("Content-Disposition", "attachment;filename="+name+".csv"); res.type("text/csv"); res.send(200, csvString); and because of the headers, the browser will create a download for the named csv file. When useful data is generated in a browser, one solution to getting it in a CSV file is to use ajax, upload it to the server, (perhaps optionally save it there) and get the server to send it back with these headers to become a csv download back at the browser. However, I would like a 100% browser solution