Importing Course Quizzes (GIFT)
The Data Import wizard's Course Quiz target imports quiz questions from a GIFT-format text file directly into LMS courses. The importer parses the file and creates Courses, Quizzes, Questions, and Answer Choices automatically, organized by the $CATEGORY: directive.
GIFT is a widely-used plain-text format for quiz questions, originally introduced by Moodle. The Course Quiz target lets LMS administrators bring questions from external sources without manually re-keying.
Requirements
- Administrator System Role.
- LMS module enabled on the portal.
- A GIFT-format file (
.gift or .txt).
Supported GIFT Question Types
| Type | GIFT Syntax (short example) |
|---|
| Multiple Choice (Single Answer) | { =CorrectAnswer ~WrongA ~WrongB } |
| Multiple Choice (Multiple Answers) | { ~%50%CorrectA ~%50%CorrectB ~%-100%Wrong } (positive percentages mark correct answers) |
| True / False | { TRUE } or { T } / { FALSE } or { F } |
| Short Answer (Keyword) | { =Keyword1 =Keyword2 } |
| Essay (Free Text) | { } (empty braces) |
| Fill in the Blank | Question text with embedded { =Answer } marker |
Unsupported types (Numerical, Matching) are skipped with a warning shown on the Review and Results pages.
Organizing Questions with $CATEGORY
The $CATEGORY: directive controls where questions are placed in the LMS. The format is:
$CATEGORY: CourseName/QuizName
::Question Title:: Question text { =RightAnswer ~WrongAnswer }
Every question that follows the directive is placed in the named Course and Quiz until the next $CATEGORY:. Multiple categories in one file create multiple courses or quizzes in a single import.
If the named Course or Quiz doesn't exist, the importer creates it. If it does exist, the questions are appended.
Step-by-Step
- Open Setup > Manage > Import Data.
- Select the Course Quiz target.
- Click Download Sample GIFT File for a sample with examples of every supported question type.
- Prepare your GIFT file. Use
$CATEGORY: directives to organize questions into the Course/Quiz structure you want. - Upload the file.
- The preview step shows a summary — detected courses, quizzes, question counts per quiz, and per-type breakdown. Any parse warnings (unsupported types, malformed questions) are shown here.
- Step through Review.
- Click Start Import.
GIFT Syntax Essentials
| Element | Syntax |
|---|
| Question title (optional) | ::Title:: text |
| Correct answer marker | =Answer |
| Wrong answer marker | ~Answer |
| Partial credit (multi-answer) | ~%50%PartiallyCorrect |
| Comments | Lines starting with // |
| Escape special character | \~\=\#\{\} |
| Question separator | Blank line between questions |
Each question block must be separated from the next by a blank line. Lines starting with // are treated as comments and ignored.
Reviewing Results
The Results page summarizes the import:
- Number of Courses created or updated.
- Number of Quizzes created or updated.
- Number of Questions created.
- Number of skipped or failed questions, with reasons.
Common reasons questions fail or are skipped:
- Unsupported question type (Numerical, Matching).
- Malformed GIFT syntax (missing braces, unescaped special characters).
- Missing question text inside a question block.
- True/False with an invalid value (must be TRUE, T, FALSE, or F).
Tips
- Validate your GIFT file with a small test import first. Sample a single category and confirm the resulting Course/Quiz/Question structure matches what you expected before importing the full file.
- Use comments to document the source of imported questions:
// Imported from Moodle export 2026-05-15. - Escape special characters in answer text when answers contain literal
=, ~, {, }, or #. - The importer is additive. Re-running an import adds new questions; it does not delete or replace existing questions. To replace questions, delete them in LMS first.
Troubleshooting Tips
- If a question block is silently skipped, check for unescaped special characters or a missing blank line between blocks.
- If True/False questions fail, confirm you used
TRUE, T, FALSE, or F (not True or true — case can matter). - If Course/Quiz names appear duplicated, the file contains questions outside any
$CATEGORY: directive (they fall into a default category). Add explicit directives. - For full symptom-by-symptom resolutions, see Data Import History and Troubleshooting.
<< Importing Portal Users | Data Import History and Troubleshooting >>