Exporting course registration results from SCORM Cloud to Microsoft Excel
Updated on
In this example, I’ll demonstrate how to use the SCORM Cloud Node.js client library to export course registration data and the SheetJS xslx module to write the exported data to a Microsoft Excel workbook.
Note: The Node.js JavaScript runtime must be installed before you can install the packages and run the code in this article. If you are on a Mac with Homebrew installed, run the brew install node command.
Initial setup
If you have not already, create a directory for your project. Initialize npm to create a package.json file, then install the scormcloud-api-wrapper and xslx modules.
API credentials
When connecting to the SCORM Cloud API, you are required to provide API credentials in the form of an Application ID (App ID) and a secret key. You can access this information from the Apps / API page.
Click the Details link to view the secret key for an application. The App ID for the application is also listed at the top of this page.
Retrieving registration results
Using your API credentials, construct an instance of the API client. You can do this from the Node REPL by running the node command without a filename.
The getRegistrationListResults method retrieves a list of registration results. Registration results include the completion status, success status, total time spent, and the overall score. Results can optionally be limited to a specific course or learner id.
Writing data to an Excel workbook
For writing the data to an Excel workbook, we’ll bring in the xlsx module and use the sheet_to_json helper function to create a worksheet. After creating the worksheet, it can be appended to the workbook and written to disk.
Expanding on the above example, build an array of objects from the result of the call to getRegistrationListResults.
The example below creates and writes to the Registration Results.xlsx file.
Further reading
Thanks for following along; hope this helps you to get started with building and exporting custom reports from SCORM Cloud. You may also like: