Import questions to quiz from an excel file

Import questions to quiz from an excel file

by riddhi shah -
Number of replies: 6

I am trying to bulk upload my excel questions list into moodle. Unable to find any support for that. Please help me with this.

Average of ratings: -
In reply to riddhi shah

Re: Import questions to quiz from an excel file

by Hiram Bollaert -

Actualy Riddhi


What you can do is creating your questions in Excel and let some VB code run to translate your questions into Moodle XML

Search for "Quiz_XLtoMoodleXML_V.1.3.1" or something like that.

I have this file but apparently it is bigger than the upload limit for this forum.

Maybe this link can help you a bit further https://sites.google.com/site/cq4mgenerator/

Cheers
Hiram

In reply to riddhi shah

Re: Import questions to quiz from an excel file

by Eric Hagley -

Well, I had this same question and found lots of really complicated half solutions. What worked for me though was something I figured out. Saved me lots of time and wish I'd thought of it before searching. This is what I did - probably too simple for some, but was the right thing for me.

1. Add a column after the question and before answer A (Hopefully you have all the correct answers set in the answer A column).

2. Input a character all the way down that column to the last question. Has to be a character that is not in your quiz.

3. Add a column after Answer A and before answer B.

4. Input a different character all the way down that column to the last question. Has to again be a character that is not in your quiz. (follow this for the number of answers you have.)

5. Put a column after your last quiz answer and add another character to that.

Copy the entire set and paste it into a good text editor. I used textwrangler on my Mac.

Do a "find and replace". If you used # as the first character then in the find column you'll have to have that in the find window (copy and paste the tab spaces too so that you have "tab"#"tab" - that is, don't actually write "tab" but what appears in the text editor which is a tab space) then in the "replace" box have  {
~=

(must include the "return" in there! ie it is not one word it is { then "return" then ~=)

Click "replace all". In the second column with the character again do a find and replace. So if you used $ then you'll have "tab"$"tab" in the find box and 
~

(again, you need the "return" in there.) Click "replace all".  Repeat this procedure until you have all the questions set out.

The last character needs to become a space between the questions too so in the "replace" box you have
}

(ie include another return after the }

Once you save that txt file, it is now a gift file that you can import into your question bank. Pretty easy really. (Important point: at the top of the file you have to include $CATEGORY:MC )

Hopefully you'll be able to (if you haven't already) upload excel questions easily now. I know I will.

Your final questions should look something like this in your text editor:

Choose the statement that is NOT correct. {
~=Pan Global is looking for diamonds.
~Pan Global's boss is Karl Johnson.
~Pan Global pays the mayor to tell lies.
~Pan Global is dumping nuclear waste.
}

Regards,

In reply to Eric Hagley

Re: Import questions to quiz from an excel file

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I think I am missing some important information in all of this. Why/how are the questions in Excel in the first place. Is the purpose of the exercise is to create multiple questions with slight variations and avoid the click, click wait click submit of the Moodle question editing system? If that is the case the Gift text file format would seem to be attractive. Or perhaps the issue is that question types are being used that do not support Gift?

In reply to Marcus Green

Re: Import questions to quiz from an excel file

by Eric Hagley -

Actually it is a good question! For various reasons (other systems spitting out the questions in excel, "the moodle guy/gal" being given questions in that format, etc) people receive the questions in excel format. If they are "the moodle guy/gal" then they have to "moodlize" them in a hurry (to impress, of course!). Having a simple way of doing so is useful, as I found out when I was given 100 questions in excel format and told to put them into a Moodle quiz. The way I outlined above was the easiest I could find to transfer the excel data into a gift file format. Very low tech I know, but reasonably effective.

In reply to Eric Hagley

Re: Import questions to quiz from an excel file

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I think I understand now, the issue was  how to convert questions in an arbitrary format stored in Excel (or whatever) into the GIFT format for import into Moodle. Which strikes me as another good reason for the GIFT format to exist as an intermediate format for conversion, interesting.