
Moderator







4 years, 9 months ago
#24034
::
Hi Shivam,
In general, to export data in csv format, you have to convert the json model data from your table to csv format (text separated by semicolons), then create a blob file and save it.
Here is one example how to do this:
Step 1) Convert json model data of table to csv format using the Papa Parse library:
var oJsonData = this.getGlobals().getVar(“oTableData”); //the json model of your table
var oCsvData = Papa.unparse(oJsonData);
Step 2) Create blob file and save it:
//download csv file
var oBlob = new Blob([oCsvData], {
type: ‘text/csv;charset=utf-8;’
});
saveAs(oBlob, “my.csv”);
In the Papa Parse documentation, you can find more options to format json to csv: https://www.papaparse.com/