Importing questions from Excel Spreadsheet to Moodle using R

Importing questions from Excel Spreadsheet to Moodle using R

by Adam H -
Number of replies: 0

Hi there,

I've been looking at a solution for importing questions from an Excel spreadsheet into Moodle, and am now looking for some help.

I've been following this guide but I am stuck: https://cran.r-project.org/web/packages/GIFTr/vignettes/GIFTr_tutorial.html

The idea is to import the question data from an Excel spreadsheet in R using the readxl package, then exporting that data in a GIFT formatted text document using GIFTr, which will then be imported in Moodle.

However I am having trouble with the code to export the data into a GIFT formatted text document.

From the link above, I am looking at the following code:

GIFTr::GIFTr(data = GIFTrData, question_names = 2, 

             questions = 3, answers = c(4:8), 

             categories = 1, question_type = 9,

            output = file.path(tempdir(), "quiz.txt")) 

Now, this code from the link is using example data from the GIFTr function. When you run this, it produces the txt file with the example question data in the GIFT format without a problem. I want to do the same but with my data from my imported spreadsheet data, and with trial and error I've been trying to understand and edit the code to export my data but without success - I'm getting all kinds of error messages.

I can't work out how to do this. My knowledge in R language is zero. I've been reading as much as possible but I just can't find the way to successfully export my data into GIFT format.

Is anyone able to offer some guidance on this?

Many thanks for your time.


Moodle version: Moodle 3.10.8+

Average of ratings: -