Question T14163
Visible to All Users

Is it possible to export the Questionnaire to Excel ?

created a year ago

Hi,

We have a requirement of exporting the questionnaire to Excel file. So whatever questions we configure in the designer it should be exported to Excel file. Pages should result in into Spreadsheets.

Is there any inbuilt functionality available to achieve this in Survey JS?

Thanks,
Santosh

Comments (2)

    Hello Santosh,
    XLSX and CSV export options are available as a part of a SurveyJS Dashboard Tabulator: Export Survey Results. To export survey results to Excel, configure a Tabulator visualizer and use its Export to Excel/CSV option to export survey results to Excel.

    Please let me know if you have any further questions.

      Hi Jane,

      We don't need the user response in the exported file but only the question related data like Name, Title, Options.
      Also we need to implement this feature on the page when user is configuring the questions inside Designer (Survey Creator)

      Is that possible to implement?

      Thanks,
      Santosh

      Answers approved by surveyjs Support

      created a year ago

      Hi Santosh,
      Thank you for the update. From what I gather, you wish to export a survey/form model to Excel. If so, you can iterate through a survey JSON and programmatically build a CSV file which contains required fields and further download the file.

      For instance, the following generateCSV function builds a CSV file which contains a question name, title, and type.

      JavaScript
      generateCSV() { const csvRows = []; // Add CSV header row csvRows.push(["Question name", "Question Title", "Question Type"]); // Loop through survey elements and generate CSV rows json.elements.forEach((element) => { debugger; const row = [element.name || "", element.title || "", element.type || ""]; csvRows.push(row); }); // Convert CSV rows to a CSV string const csvContent = csvRows.map((row) => row.join(",")).join("\n"); // Create a Blob with the CSV content and initiate the download const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" }); const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "survey.csv"; link.click(); }

      View Demo

      You can update this code and include required information about survey elements.

      I hope this helps. Please let me know if you have any further questions.