Sunday, July 17, 2011

How to use the humble comma delimited (CSV) file to display private coursework marks right on your Moodle coursepage

Today's post is about a crude but effective method to display confidential user coursework data on any Moodle 1.9.x course page. All you need is the Display Data mod (created by Serafim Panov) and an Excel spreadsheet saved as a CSV (comma delimited) file. You can even dispense with Excel and just use good old Notepad to create the CSV file!

Do you like to use Excel to store your students' coursework marks? Like this?

Would you like to feedback the detailed marks to your online-Moodle students, but are concerned about privacy issues?

If replied "yes!" to both questions, then boy oh boy, do I have a treat for you. It's a Moodle treat from 2007 and it's really very simple to use.

Whoa! What about the Moodle Gradebook? Doesn't it already show such data? Well, as far as I can see (perhaps someone can correct me on this!), the Grade book doesn't show such detailed data. in my humble opinion, it is not as tabular, as compared to an Excel table. See below for an example of a Moodle Gradebook screen output.

Does the above Gradebook give detailed feedback on score breakdowns? I don't think so. At least not the standard Moodle Gradebook. If you have mastered the Moodle Gradebook, and it meets your needs, then good for you! This post will probably be a waste of your time. But if you're like me, and have not yet invested much time in the Gradebook, then read on!

Below is a typical spreadsheet with a table of coursework data. Cells A2 to A4 store the usernames (shown in red text):  admin, student and sarah. So Ms. Sarah has scored 50%, 67% and 80% for her Test1, Test2 and Quiz1 respectively.
What we want is to show a user's coursework data to himself/herself alone, on the actual Moodle course page.

One of the fields MUST be named as user. Not username, but user. In the example above, of A1 were to contain the word username instead of user, the mod will fail. Strange but true. I suppose that's how the mod was hardcoded.

Each field MUST have a unique name. You cannot have two or more fields with identical names.

The field user need not be the first column (the "A" column). It can be on the second column (the "B" column). For example, the table below will also work!

Do not include merged cells in your pre-CSV spreadsheet. In the example below, you would have to delete row2 because of the merged cells that contain the title "Show and Tell" Speech Scores. Just keep all your data in a simple rectangular shape with no fancy merged-cell titles or subtitles, and you should be fine.


Question: what happens if a username is omitted from the list? For example, suppose John Doe were enrolled in the course, but his username (which is also john) is not list. We have admin, student and sarah. But no john. Well the good news is that John Doe will see nothing. Just a blank where the table should be. This makes sense. John's username was not listed in the table (or inside the to-be-made-CSV file), so he rightly sees nothing!

Now this begs the question. How does the Moodle Course Administrator (usually the teacher or facilitator) compile the usernames of the course with minimal tears? The best answer I have is to install the Enhanced User Administration block found in

That block (shown above), allows the Course Administrator (you, I assume) to export a list of usernames to a CSV text file. You would probably have to open that CSV file with Excel and then delete the columns or data that are unwanted, leaving just the usernames intact. Phew! That was a diversion worthy of another post on

If you have an easier or faster way of compiling a list of usernames for your course, please share with other readers of this blog.


Anyway, let's get on with this post!
Next, save the spreadsheet, not as a XLSX or XLS file, but rather as a humble CSV file.

If you open up the comma delimited file with Notepad, or with any other  text editor, you should see this:


Next, go to and download the display data mod. Extract the zip file and FTP the folder named displaydata in the mod folder of your Moodle site. Install as usual by going to the Site Administration | Notification section.

After you have installed the mod, click the "Turn settings on" button and insert the activity by choosing "Display data" from the "Add an activity" drop-down list.

Enter the Title, for example "Coursework Scores" and select the CSV file from your hard disk by clicking the "Browse" button.

After you have uploaded the file, you, as the admin should be able to see the entire table's contents.

Wow! All this from a humble comma delimited file that could be created by using Notepad! Now, the real magic happens when the user, say Sarah, logs in and and clicks on the activity named "Coursework Scores".

What Sarah will see, which is the whole point of this activity or mod, is her own Coursework scores and only her scores. Thus you will have achieved a huge degree of user privacy. In addition, Sarah is able to see at a single glance, all her coursework scores in a very summarised and simple fashion. Feast your eyes on the table below. Isn't it elegant? Isn't it an epitome of simplicity?

This is what Moodle is all about. This is poetry in motion. This is beauty and simplicity.

"You mean that's it!??" you may ask. Not impressive enough for you? Maybe you still don't understand the application of this mod. Well, to summarise, I can put a crowded table onto my Moodle coursepage where I can see all data as the administrator, but the data is automatically filtered to a student user only his or her own data. Niw I don't know about you, but I think that's cool, real cool.

To drive home my point, here's an example of what I can see on my Moodle coursepage as an Administrator:

And here's what Sarah (one of the student whose marks are in the table) sees when she logs on and clicks on the link:

So that's the whole point of this post. Voila. It is finished! C'est magnifique

If you think this is useful for your Moodle 1.9.x course, do drop me a comment so that I will know that at least someone has benefited from the two-and-a-half hours I have invested in this post.

Frankie Kam
Sunny Melaka, Malaysia

If you like this post or site
a small donation would be nice but would last only a day,
otherwise leaving a comment (or a compliment) below will last me a month!

No comments:

Post a Comment

Ratings and Recommendations by outbrain