cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pasquinit
New Member

Export assignment comments for course

Jump to solution

Is there a way to export the comments made on assignments? I'm looking for a way to access the feedback that I've given to students throughout the semester for help in composing narrative comments. 

The last time I saw this addressed was back in 2016, so I'm wondering if there is any change.

2 Solutions
Steve_Watts
Community Champion

Hi  @pasquinit 
Are you talking about annotations added to the submitted document itself in the doc viewer, or text comments added using the text box on the righthand side in the Speedgrader? For the text comments, each submission has a "Download submission comments" link. However this involves going to each submission in turn and downloading them one by one, which is obviously not practical when you have a large class. I don't think there is a method to download them in bulk from within the course but you could write some code using the Canvas API that would do it. This requires a bit of programming skill - one of my colleagues created a script that exports comments from a specific assignment as a spreadsheet. Unfortunately he no longer works here so I can't fully explain how his code works but if you look at the documentation for the API it might give you some ideas.

View solution in original post

I'm not really an expert in the API but looking at my colleague's code, it seems to be making this call:
/api/v1/courses/ COURSE_ID /assignments/ ASSIGNMENT_ID /submissions
to get the submissions for a specified assignment, then looping through the data set that's returned to create a table with username, submission date, grade, comment etc for each submission in the data.

The documentation here might be helpful: https://canvas.instructure.com/doc/api/submissions.html 

View solution in original post

13 Replies
Steve_Watts
Community Champion

Hi  @pasquinit 
Are you talking about annotations added to the submitted document itself in the doc viewer, or text comments added using the text box on the righthand side in the Speedgrader? For the text comments, each submission has a "Download submission comments" link. However this involves going to each submission in turn and downloading them one by one, which is obviously not practical when you have a large class. I don't think there is a method to download them in bulk from within the course but you could write some code using the Canvas API that would do it. This requires a bit of programming skill - one of my colleagues created a script that exports comments from a specific assignment as a spreadsheet. Unfortunately he no longer works here so I can't fully explain how his code works but if you look at the documentation for the API it might give you some ideas.

Thanks for getting back to me.

Yes. I'm thinking about the text comments that appear next to the speedgrader window, and you're right, that process of one-by-one download would be too time consuming to be useful. 

If you have a copy of the API call that produced a spreadsheet for an individual assignment to share, I think that I could probably work on the filter to give me all of the comments for a particular student.

I'm not really an expert in the API but looking at my colleague's code, it seems to be making this call:
/api/v1/courses/ COURSE_ID /assignments/ ASSIGNMENT_ID /submissions
to get the submissions for a specified assignment, then looping through the data set that's returned to create a table with username, submission date, grade, comment etc for each submission in the data.

The documentation here might be helpful: https://canvas.instructure.com/doc/api/submissions.html 

It sounds like this is what I am hoping to do at the assignment level. Then it would be about looping over all assignment_id within the course to get all comments on all assignments. 

The task after that would come down to sorting the data appropriately as I would like it grouped by student, not by assignment_id.  I don't think that will cause much trouble.

Thank you for sharing.

Can we remove the claim of "solved" from this reply? This is a helpful, thoughtful, useful reply but it doesn't not answer the question of how to download the comments posted on assignments. This is still "unsolved" and waiting for a reply from Canvas. 

0 Kudos
bsiever
Community Member

Hi Tom,  

I needed to retrieve comments too, so I used the University of Central Florida's Python API (GitHub - ucfopen/canvasapi: Python API wrapper for Instructure's Canvas LMS ).

Here's a link to the script I used: http://siever.info/canvas/GetAllComments.py

To use it you have to:

  1. Install Python and the UCF Python API as described at https://github.com/ucfopen
  2. Get an API key
  3. Edit the script with the URL you use, your course ID, and your API key.
  4. Run the script (For me, "python GetAllComments.py" at a command prompt)

Do you know how to export the output I see in the reminal to a csv file? I got it all to work (thank you!), but I am new to python and linux and scripts. I used the script you shared here: https://community.canvaslms.com/t5/Question-Forum/Export-assignment-comments-for-course/m-p/176457, more specifically, here: http://siever.info/canvas/GetAllComments.py .

 

Thanks for any help - I am using debian buster, python3, pip3

0 Kudos

Sorry for not replying sooner @mikegdye .  

The script currently uses semicolons, but you can just change the two ';' to ',' to get commas.  If there are commas in the comments it may be a problem. I'd suggest changing the final line from:

              print(a.name + ';' + studentName + ';' + c['comment'])

to something: 

              print('"' + a.name + '","' + studentName + '","' + c['comment'] + '"')

That will put double quotes around each item (I think importing into Excel can be set to treat anything between double quotes as a single thing and ignore the commas inside double quotes).  Of course, this may still be a problem if your comments include double quotes. 

If you're using a shell prompt (in Linux or macOS or some unix-like environment in Windows), you can "redirect" the output to a file using the greater than symbol.  I'd do a command like:

python GetAllComments.py > comments.csv 

The thing after the ">" is just the name of the file to send the output too and could be anything you want.  The default location of the new file will be the folder you're terminal is operating in (probably where the script is located).

Most unix-like systems also have a utility called "tee" that can be used to send the output to a file as well as the screen.  I often use this to watch the progress of command as well as to store results in a file.  It's used with the "|" (pipe) rather than the redirect (the ">"). Something like:

python GetAllComments.py | tee comments.csv 

 

tawnya_means1
New Member

I need to do something similar, but not for comments. I need to pull the rubric elements along with the score for that element. 

Context: we have the same assignment across multiple terms with different rubrics. For our accreditation data collection, we need to go back through about 30 sections and pull how the students were scored for each element of the particular rubric attached to two different assignments. All this data can be dumped into a spreadsheet which we will then analyze.

I know that Outcomes is the ideal way to do this, but since the assignments were not originally set up this way, I am looking for a more efficient way than having a student worker go through an read each assignment rubric and transfer the scores to a spreadsheet.

I would appreciate any ideas!

Hi Tawnya, 

I suspect that it's possible to use the Python API (described in my post abore) for this as well, but it may be a little trickier than merely extracting comments was.  If you don't feel comfortable trying this (or don't have the time), you may be able to either find a student who has a fair amount of Python programming experience or perhaps someone at your school who does Canvas support. (They may find knowing the Python API to be handy for other needs as well)

  Bill

0 Kudos

Thanks Bill!

0 Kudos

I do not understand that we can not download the Rubrik with the comments, grade and all.  This becomes a completely irrelevant tool if we can not use it to download in our system.

0 Kudos
KathrynCatlin
Community Member

I found a code snippet on another thread and have messed with it to get it to spit out rubric ratings & comments as well.  Run this on [yourschoolscanvassite]/graphiql -- it's far easier to use & understand than I expected.  I'm just going to save the output in one text file per assignment.  

 

query MyQuery {
  assignment(id: "356219") {
    name
    pointsPossible
    submissionsConnection {
      nodes {
        user {
          email
        }
        grade
        turnitinData {
          score
        }
        rubricAssessmentsConnection {
          nodes {
            score
            assessmentRatings {
              criterion {
                description
                longDescription
                ratings {
                  points
                  description
                }
                points
              }
              comments
            }
          }
        }
        commentsConnection {
          nodes {
            comment
          }
        }
      }
    }
  }
}