EXCEL to GIFT format export tool - Excel2GIFT continued

EXCEL to GIFT format export tool - Excel2GIFT continued

by Jeff Shrek -
Number of replies: 5

Excel2GIFT v1.2 has been released ...
Has it really been 16 years since I originally posted my tool?
Here is link to the original thread: http://moodle.org/mod/forum/discuss.php?d=66660

I have a very minor update which adds the ability to specify the $CATEGORY where you want the questions imported.

It does require manual edit of the exported GIFT file before import, but does work if specified.

If you open up your GIFT file you export from Excel, you will see these lines:

//  CATEGORY - To specify a CATEGORY for imported questions, uncomment $CATEGORY line below, and change the 'Imported-Questions' to whatever category name you want.
//   I recommend you change it to the name of the specific quiz you are importing for, so you can find questions easier and re-use them later.
//   If you are unsure what to put on this category line, then create a sample question in your quiz, and then export it in GIFT format, and then check the exported file and copy and paste the $CATEGORY line.
//  $CATEGORY: $course$/top/Imported-Questions

You would uncomment the $CATEGORY line

Excel2GIFTv1.2.zip should be attached to this post below.


Below are just some terms I am adding just to make searching for this topic easier:
export from excel to moodle quiz
import from excel to moodle quiz
export from excel to quiz
import from excel to quiz
export questions from excel
import questions from excel
export quiz questions from excel
import quiz questions from excel

Average of ratings: -
In reply to Jeff Shrek

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

by Mark Marijnissen -
Hi Jeff, we realy like your export tool, thanks for the dev.

a small question, is it possible to add somewhere Tags, so we can devide questions in 4 parts to use with exams?

bet regards,

mark
In reply to Mark Marijnissen

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

by Jeff Shrek -
Can you provide an example of what you mean by Tags? Where would they go and/or where would they show up on the QUIZ?
In reply to Jeff Shrek

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

by Mark Marijnissen -
Sure.

At this moment, we’re selecting question bank en choose the question for editing, select edit > manage tags (or select edit > edit question, scroll down tot Tags and select the tag needed)

we use those tags, within the quiz, to offer a number of questions per topic.
We then select in the quiz, for example, 10 questions from a group of 40 questions

our questionpool sometimes consists of 4 topics (tags) of 40 questions.
At the moment I have to manually adjust this for 160 questions.
If there is a column in the sheet, which I can fill in and include in the export to GIFT format (and of course import into moodle) this would be great
In reply to Mark Marijnissen

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

by Jeff Shrek -
I did some digging, and found this:
https://tracker.moodle.org/browse/MDL-68338

So yes Tags apparently are supported on GIFT import. This means that it should be possible to add to the export code.

Most likely we would need to add another column or two where the Tags/ID would be entered for each question, and then could be parsed with everything else on export.

However
(1) I do not use Tags, and
(2) I am extremely busy,
so that puts this as a very low priority for me to look at right now.

I will post back if/when I get around to looking into this more. Sorry I can't help more right now.
In reply to Jeff Shrek

Odp: EXCEL to GIFT format export tool - Excel2GIFT continued

by Łukasz Słomczyński -
Dear Sir,

First of all I would like to thank you for your work and for creating this great and simple to use tool :-)
I came across Excel2GIFT as I was doing research on how to import QuestionPools to ILIAS LMS.
Using your tool to create *.gft files and then converting them with SimpleQuestion tool was the way to go!

While I was going through your original thread, I've noticed that some users were struggling with file formatting for "non-standard" characters.
Since I was interested in UTF-8 compliant output, I was able to "develop" a following solution (with the help of Stack Overflow: Save text file UTF-8 encoded with VBA)
and I would like to share it with you and the comunity below.

In the bottom part of the Public Sub ExportGIFT() VBA module:
1) Comment out the original section:
'Export To Text File
'Application.ScreenUpdating = False
'On Error GoTo EndMacro:
'FNum = FreeFile
'Open FName For Output Access Write As #FNum
'    For q = 0 To 100
'        If qGIFT(q) <> "" Then Print #FNum, qGIFT(q)
'    Next q
'EndMacro:
'On Error GoTo 0
'Application.ScreenUpdating = True
'Close #FNum
2) And replace it with the following one:
'Export To Text UTF-8 File
Application.ScreenUpdating = False
On Error GoTo EndMacro:
Dim fsT As Object
Set fsT = CreateObject("ADODB.Stream")
fsT.Type = 2 'Specify stream type - we want to save text/string data.
fsT.Charset = "utf-8" 'Specify charset For the source text data.
fsT.Open 'Open the stream And write binary data to the object
    For q = 0 To 100
        If qGIFT(q) <> "" Then fsT.WriteText qGIFT(q) 'fsT.WriteText "special characters: äöüß"
    Next q
EndMacro:
On Error GoTo 0
Application.ScreenUpdating = True
fsT.SaveToFile FName, 2 'Save binary data To disk
One small issue that I could not fix:
After opening a *.gft file (created like described above) in Notepad, Notepad++, Firefox, whatever, the file looks good,
but when I open it with SimpleQuestion tool, an unidetified character appears in front of the "credits" section.
This is not a problem, as all you have to do is delete it, and you are ready to go.
Unfortunately I do not run any moodle LMS at the moment, so I cannot verify if this file would cause eny errors on import.
Maybe someone else from community will give it a try :-)

I've attached a screenshot to show how this char looks. When I copied it and pasted in the Character Idetifier website it turned out,
that this is a set of 3 chars: 
U+00EF LATIN SMALL LETTER I WITH DIAERESIS character (&#x00EF;)
U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK character (&#x00BB;)
U+00BF INVERTED QUESTION MARK character (&#x00BF;)

As raw characters:


Since for my workflow all I have to do is delete it (them?) I did not ivestigate it any further.

Have a nice day!
Attachment unidentified-char.png