Forum

Jennifer Häfner
      Has successfully completed the online course Intermediate (200)
      Has successfully completed the online course Advanced (300)
      Has successfully completed the online course Basics (100)
      Has successfully completed the online course Advanced (310)
      Has successfully completed the online course Advanced (320)
      Has successfully completed the Intermediate Certification
      Has successfully completed the Advanced Certification
    3 years ago #24034
    Up
    0
    Down
    ::

    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/