             name     = store.get_student_name(student)
             email    = store.get_student_email(student)
             email    = if email? then "'#{email}'" else 'None'
-            line     = "    {'name':'#{name}', 'email':#{email}, 'grades':[#{grades}], 'comments':[#{comments}]},"
+            id       = student.get('student_id')
+            line     = "    {'name':'#{name}', 'id':'#{id}', 'email':#{email}, 'grades':[#{grades}], 'comments':[#{comments}]},"
             content += line + '\n'
         content += ']\n'
         @write_file(@path('py'), content)

        timestamp  = (webapp_client.server_time()).toISOString()
        content = "# Course '#{@props.settings.get('title')}'\n"
        content += "# exported #{timestamp}\n"
        content += "Name,Email,"
        content += ("\"grade: #{assignment.get('path')}\"" for assignment in assignments).join(',') + ','
        content += ("\"comments: #{assignment.get('path')}\"" for assignment in assignments).join(',') + '\n'
        for student in store.get_sorted_students()

            comments = comments.replace(/\n/g, "\\n")
            name     = "\"#{store.get_student_name(student)}\""
            email    = "\"#{store.get_student_email(student) ? ''}\""
            id       = "\"#{student.get('student_id')}\""
            line     = [name, id, email, grades, comments].join(',')
            content += line + '\n'
        @write_file(@path('csv'), content)

