Uploading data to a database
Sometimes you may want to provide a complete database as a reference tool for students, or you may want to simply enter some basic content into a database that can later be edited or added to by you or students. Choosing to “upload entries from a file” requires a little work ahead of time to ensure the content will be read and placed properly in the file.
- Prepare the upload file:
- Setup and note the exact names you set for fields in your Moodle database
- Use Excel (or other database/spreadsheet program that allows saving as a .CSV file) to prepare your database. (You can also use a text editor and separate fields with commas
- In the first row of your file, the field names should be typed exactly as they were entered in your Moodle database setup. For example: “state, capital, state_flower, state_bird, population,” etc.
- Save the file as a comma separated variable file (.csv)
- To upload your prepared file:
- Click on your database link in your Moodle course.
- Click on the “Add entry” tab.
- Click on the “Upload entries from a file” link.
- Click on the [Browse] button to find your file.
- Click the [Upload file] button to add the file entries to your database.
- If successful, it will import the entries then report how many were added. To view them, click on the “View list” tab.
You can upload information this way for just a few fields for database entries and then go back to add other content. This is a particularly important note for databases where you have set up a file field or picture field. These field entries must be added individually. For example, you may want to set up a database for information about the states and start with just a list of state names. Students would then need to go to each state listed and edit the entry to add pictures of the state bird, or to add a report file they created that explains other information about that state.