cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Member

How to upload a list of assignments as instructor?

Jump to solution

I have multiple assignments I'd like to create via a file upload. Is it possible as instructor to upload new assignments as a CSV file?

Tags (1)
1 Solution

Accepted Solutions
Highlighted
Adventurer III

samson@umich.edu 

No, it is not possible to upload a list of assignments directly into Canvas for creation.

There is the ability to make an assignment with the settings you would like and then duplicate it, possibly multiple times. You would need to go back and edit the titles and due dates. More information is available in this lesson from the Canvas Instructor Guide: How do I duplicate an assignment? 

The closest that Canvas has to scripting this is to use the Canvas REST API and the create an assignment endpoint. With access to curl and an access token from Canvas, you could script the information that is in your CSV file to do this. Unless you have some programming skills, I would create the curl command while it's still in Excel. Then you can copy/paste those into a command line somewhere and have it make the calls to create the assignments.

The REST API requires some technical skills that you may or may not have. The call to create an assignment often confuses people because there needs to be a literal assignment in the form field names: it's assignment[name] not just name. There is more help available in the Canvas Community if you run into issues.

There is a learning curve to using the REST API. If you don't have the technical skills it will be quicker to make an assignment and duplicate it within Canvas. If the assignments are substantially different, then you can just create them individually within Canvas, but then reuse the assignments in other courses (even in future terms) by importing the course content.

Another possibility is to use the built-in GraphQL editor. It's found by going to your base Canvas instance and adding /graphiql to the URL path. It doesn't allow you to create multiple assignments at one time, but you can copy/paste from Excel directly without having to learn the API.

Here's an example that creates a 10 point assignment called "Daily Takeaway 1" with the assignment description of "What did you take away from today's class?" The times need entered in ISO8601 format using UTC time. The courseID is my sandbox course, you'll need to change that. There are other properties that you can set by using the graphql explorer. The assignment block at the end is because it gave me an error if I didn't return something, so I just returned the Canvas ID of the assignment that was created. I also wrapped the input property so it was more readable.

mutation newassignment {
__typename
createAssignment(input: {
courseId: "896851",
name: "Daily Takeaway 1",
description: "What did you take away from today's class?",
dueAt: "2020-01-02T02:40:00Z",
pointsPossible: 10,
submissionTypes: online_text_entry,
gradingType: points}) {
assignment {
_id
}
}
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Here's what the assignment looks like in Canvas.

333888_pastedImage_3.png

You could use Excel to create a structure like the above and then copy/paste into the /graphiql interface and execute it. Then you copy/paste the next one. Repeat until you have all of your assignments created.

I think the programmatic way using the REST API is easier than the GraphQL approach and it can be automated. I'm biased because I've done a lot of work with the API and can write a short program. I've used it that way myself with some PHP code to create multiple assignments based off the due dates and section number -- so essentially what you're asking about, just not a CSV file.

For people lacking the technical skills, it needs done through the web interface as there is no CSV upload capability.

View solution in original post

5 Replies
Highlighted
Adventurer III

samson@umich.edu 

No, it is not possible to upload a list of assignments directly into Canvas for creation.

There is the ability to make an assignment with the settings you would like and then duplicate it, possibly multiple times. You would need to go back and edit the titles and due dates. More information is available in this lesson from the Canvas Instructor Guide: How do I duplicate an assignment? 

The closest that Canvas has to scripting this is to use the Canvas REST API and the create an assignment endpoint. With access to curl and an access token from Canvas, you could script the information that is in your CSV file to do this. Unless you have some programming skills, I would create the curl command while it's still in Excel. Then you can copy/paste those into a command line somewhere and have it make the calls to create the assignments.

The REST API requires some technical skills that you may or may not have. The call to create an assignment often confuses people because there needs to be a literal assignment in the form field names: it's assignment[name] not just name. There is more help available in the Canvas Community if you run into issues.

There is a learning curve to using the REST API. If you don't have the technical skills it will be quicker to make an assignment and duplicate it within Canvas. If the assignments are substantially different, then you can just create them individually within Canvas, but then reuse the assignments in other courses (even in future terms) by importing the course content.

Another possibility is to use the built-in GraphQL editor. It's found by going to your base Canvas instance and adding /graphiql to the URL path. It doesn't allow you to create multiple assignments at one time, but you can copy/paste from Excel directly without having to learn the API.

Here's an example that creates a 10 point assignment called "Daily Takeaway 1" with the assignment description of "What did you take away from today's class?" The times need entered in ISO8601 format using UTC time. The courseID is my sandbox course, you'll need to change that. There are other properties that you can set by using the graphql explorer. The assignment block at the end is because it gave me an error if I didn't return something, so I just returned the Canvas ID of the assignment that was created. I also wrapped the input property so it was more readable.

mutation newassignment {
__typename
createAssignment(input: {
courseId: "896851",
name: "Daily Takeaway 1",
description: "What did you take away from today's class?",
dueAt: "2020-01-02T02:40:00Z",
pointsPossible: 10,
submissionTypes: online_text_entry,
gradingType: points}) {
assignment {
_id
}
}
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Here's what the assignment looks like in Canvas.

333888_pastedImage_3.png

You could use Excel to create a structure like the above and then copy/paste into the /graphiql interface and execute it. Then you copy/paste the next one. Repeat until you have all of your assignments created.

I think the programmatic way using the REST API is easier than the GraphQL approach and it can be automated. I'm biased because I've done a lot of work with the API and can write a short program. I've used it that way myself with some PHP code to create multiple assignments based off the due dates and section number -- so essentially what you're asking about, just not a CSV file.

For people lacking the technical skills, it needs done through the web interface as there is no CSV upload capability.

View solution in original post

Highlighted
Community Member

Brilliant. I was learning the REST API to upload quizzes anyway (that'll be another query to the group) so I'll try this. Thank you.

Highlighted
Adventurer III

This one is easier than quizzes Smiley Happy

0 Kudos
Highlighted
Community Member

You have a script you're willing to share for uploading a quiz?

I've developed a system that transcribes my lecture, then identifies key

terms and phrases used in class and automatically selects questions from a

test bank based on what was discussed in class. I want to be able to upload

those questions into Canvas using the API.

Perry

0 Kudos
Highlighted
Adventurer III

That application sounds really awesome!

Sorry, I don't have a script I'm willing to share for quizzes. My depends on a library I wrote rather than using a standard library and only adds questions to an existing quiz rather than creating a new quiz. It requires a lot of editing each time I run it and was more of an ad hoc project.

The basic process for a new quiz is to create a new quiz and get the ID that is returned, then add the questions to it. A quiz with n questions would have n+1 API calls. That is, unless you want to use question groups to randomize the question order; in that case you need to obviously add the question groups before adding the questions.

0 Kudos