Export to excel functionality in simplifier

Tagged:
  • Shivam
        3 years ago #24032

        Hello simplifier community,

        I am working on some tables in my mobile application. On click of a button, all I want is that the the data from the table should be exported to an excel file  like pdf. can it be implemented in simplifier ? If yes, then how can it be implemented ? Suggest me a solution for this. Thanks in advance.

        Regards,

        Shivam Gupta

        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/

          Shivam
              3 years ago #24086
              Up
              0
              Down
              ::

              Hi,

              Thank you for the help, but I want to export my app data into a spreadsheet (with .xls extension) not in csv format. Please tell me if there anything I can do to achieve this in simplifier.

              Regards,

              Shivam Gupta

              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 #24087
                Up
                0
                Down
                ::

                Since you also can open .csv files in Excel (using the correct delimiter), we usually implement an excel export like in my example above.

                If you have to export an .xls file, you can take a look at javascript libraries that export data in the required format, like https://sheetjs.com/opensource.

              Viewing 4 posts - 1 through 4 (of 4 total)

              You must be logged in to reply to this topic.