EXCEL to GIFT format export tool - Excel2GIFT continued

EXCEL to GIFT format export tool - Excel2GIFT continued

аз Jeff Shrek -
Number of replies: 9

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

In reply to Jeff Shrek

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

аз 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

аз 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

аз 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

аз 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

аз Ł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
In reply to Jeff Shrek

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

аз Ezzeddin Hamed -
Hello Jeff,

This is a really wonderful tool and very useful.

My question is about the line: $CATEGORY: $course$/top/Imported-Questions
/top/Imported-Questions refers to the category structure inside a course.
What about $course$/ could it be used to refer to the course name? For example to replace it with the course short name or possibly the course id, if this works, then multi-course question importing could work, which is what I intend to do.

Is this possible?

Thanks,
In reply to Ezzeddin Hamed

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

аз Jeff Shrek -

I modified this tool over a year ago, and honestly am not sure how to answer your question because I do not remeber what I did! I modified to do exactly what I needed, so can not confirm whether it will do what you want or not.

What I recommend is that you create an entirely new TEST COURSE ONE and TEST COURSE TWO and add a few Test Classes to each and then play with imports to see if it will import how you want. 

Also if you do this, make sure to DELETE your imported test data everytime BEFORE you import the next batch of test data, otherwise you will end up with a big bank of useless test questions.

In reply to Jeff Shrek

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

аз Ezzeddin Hamed -
Hello Jeff,

Thanks for your reply and suggestions. I am already doing testing on a testing site, so there is no worries about it.

I have tried changing $course$/ to different possibilities trying to find out what could refer to the course, but nothing worked.
I have tried $courseid$/, $shortname$/, removing one $ sign from each side & removing the $ sign, but all trials ended with anything except the 2 $ signs that a category with that is created.
 
So nothing changed till now.
Actually, my question could be a general GIFT format question rather than specific to your tool.
 
Regards, 
In reply to Ezzeddin Hamed

Re: EXCEL to GIFT format export tool - Excel2GIFT continued

аз Jeff Shrek -

If you look at this and scroll down to the "Specifying Categories" section

https://docs.moodle.org/4x/sv/GIFT_format

You can only specify one specific category for import per GFT file.

My tool is using the course name as part of the name to make up the CATEGORY name that it will be imported too, but does not actually have anything to do with which course it is imported too.

You need to manually select which course you are importing the questions too, and then the category name will be created (if its specified in the GFT file) under the course you have chosen.