Moodle Help & Support
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" link in the Database Activity administration block. (Both CSV and ODS formats can be opened with MS Excel.)
- Click into the database you wish to clone.
- In the Administration block click Export entries (or click the Export tab within the database)
- 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. You will have the option of either opening or saving the file.
- 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" link in the Database activity administration block. 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 Administration block click Import entries (alternatively you may set up a brand new database and import entries at the point where you add fields)
- Select the correct delimiter (\t if you have selected Tab as described in the step above)
- Upload the file from your computer using the file picker (or by drag and drop)
- Click Submit
- After upload page import.php comes back blank if it failed. If successful you'll read a message like, "1 entries saved".
The following other resources are also relevant to this topic:
Queries, comments or questions?
Please contact your local elearning support team.
or email: firstname.lastname@example.org
If you have any comments on how you think this help can be improved then please email Learning-Technologies@nottingham.ac.uk