I am using papa parse library. It helped me in converting JSON to CSV but how can I download the same data into a excel file. My data is huge
Asked
Active
Viewed 6,279 times
3
-
If you're searching just how to make the download this could help http://stackoverflow.com/a/3665147/4682556 – Dan May 09 '16 at 04:49
2 Answers
5
If I'm understanding your question correctly, you have a CSV file which you now want to tell the browser to download? Have you looked at https://github.com/eligrey/FileSaver.js/ ? Allows you to tell the browser to download a wide variety of files.
An example in using it:
var blob = new Blob(myBigCSVFile, {type: "text/csv;charset=utf-8"});
saveAs(blob, "file.csv");
The browser, upon reaching the saveAs
function will download the file you specified.

qwelyt
- 776
- 9
- 23
-
-
Glad it worked for your needs! If it solved the problem, please mark the answer as accepted. – qwelyt May 09 '16 at 06:41
-
2You can avoid using `Blob`. `let file = new File([data], "test.csv", { type: "text/csv;charset=utf-8" }); saveAs(file);` – backslashN Jul 20 '18 at 10:38
-
^ this worked for me. Server was returning csv so blob conversation wouldn't work. – Ben Ahlander Dec 10 '21 at 17:26
0
Checkout SheetJS/js-xlsx library.
Supported read formats: Excel 2007+ XML Formats (XLSX/XLSM), Excel 2007+ Binary Format (XLSB), Excel 2003-2004 XML Format (XML "SpreadsheetML"), Excel 97-2004 (XLS BIFF8), Excel 5.0/95 (XLS BIFF5), OpenDocument Spreadsheet (ODS)
Supported write formats: XLSX, CSV (and general DSV), JSON and JS objects (various styles)

Papa
- 1,628
- 1
- 11
- 16