Moodle Help & Support
This refers to Moodle 3.11 from August 2022 onwards
How to export database entries for import into another Moodle database
If you use the normal "Import" (in the Administration block, click on Module administration > Import) then the structure of activities comes across but not the content, because content is user-generated (by the students as well as staff) and the same students aren't normally enrolled in the destination module. No student or other user data comes across - it's an empty database, but with the fields and templates set up as in the previous module. Even your own teacher-contributed content does not come over.
If you do want to carry over content that was created in a database, you can if you wish export this data and import it into the new course as a starter for or information for next year's students.
Note that image fields cannot be exported with databases and glossaries into another module.
You can export entries either in CSV (comma separated values) or ODS (OpenOffice Calc) formats by clicking the 'Export' tab at the top of the database or by clicking the 'Export entries' in the drop-down menu from the cog 'Actions menu'
- Click into the database you wish to clone and go to the 'Export' tab.
- If your database does NOT have commas in the text, leave the default as a CSV file with comma delimiter. If you have commas within the text in the database (which is usual!) then use ODS or CSV with a tab delimiter (or colon if you are sure there are none of those in the text).
- Select which fields from the database you wish to have exported. By default, all fields are checked to be included.
Note: image fields cannot be exported.
- Click on 'Export entries'. The file will download.
- Save the file on your computer (it will still have the file extension csv).
You can import entries via a CSV file if you click the 'Import entries' option of the cog drop-down 'Actions menu'. CSV means Comma-Separated-Values and is a common format for text interchange. You can create your own csv file: in this case the expected file format is a plain text file with a list of field names as the first record. The data then follows, one record per line. Records should be delimited by new lines (usually generated by pressing RETURN or ENTER in your text editor). Tabs can be specified using \t and newlines by \n.
Alternatively you can import a file exported from another Moodle database, e.g., in a previous year's module.
The database into which you would like to import the entries needs to be set up with the correct fields in advance.
In the database to which you would like to import entries:
- In the database you want to import the database to, click on the 'Cogwheel' menu and select 'Import entries' (alternatively you may select the 'Add Entry' tab in order to set up a brand new database and import entries at the point where you add fields).
2. Select the correct delimiter (\t if you have selected Tab as described in the step above).
3. Upload the file from your computer using the file picker (or by drag and drop) and click on the 'Submit' button.
4. After upload page import.php comes back blank if it failed. If successful you'll read a message like, "12 entries saved".
Below is an example of a file which can be imported
Online collaboration with Moodle Databases and Wikis is a useful Xerte toolkit that will help you use both Wikis and Databases more effectively for student collaboration.
The following other resources are also relevant to this topic: