Showing results for 
Search instead for 
Did you mean: 
Community Participant

Automatically remove users from Canvas

We are currently using this C# script to upload users into our Canvas instance. 

canvas/sis/sis_import_standard/CSharpCanvasSISPublish at master · unsupported/canvas · GitHub 

This script does what we need. However, it does not remove students who are not in that instance or mark them as inactive so I have teachers sending me emails to remove students that may have moved classes out of the district. As you can imagine, in a district with around 6,000 students, this get's a bit tedious. I would normally do a batch update but since we are halfway through the semester I can't erase gradebook data and anything else like that. 

Is there a way to remove any students who do not appear to be in the CSV we are importing with a script of some kind? 

7 Replies
Community Coach
Community Coach

 @trenton_tyler ,

I am going to share this question with the‌ and‌ groups.  These groups are more specialized to answer questions from the development/script side of things.   Hopefully this will get you the answer that you need.


Community Champion

Hi  @trenton_tyler ‌,

From just taking a quick look at the tool you're using, it appears that it simply uploading a csv file‌ from a location that you specify. 

With the SIS you're using can you pull a list of students who are no longer enrolled at the school or a list of courses that students have been removed from?

If so you would just need to create either an enrollment file making them as being deleted from the course or an user file and mark them as deleted. 

SIS Import Format Documentation - Canvas LMS REST API Documentation 

Hope this helps. If you have any further questions please let me know.


Community Coach
Community Coach

Hi  @trenton_tyler ,

 @bneporadny  has given you some great advice for achieving what you would like. I wanted to add some additional info. From what I have been told, when you remove an enrolment, if you later re-add it, the old information will appear in the gradebook again.

I will admit we have never sat down and actually tested this to confirm, so you might want to do this in your Beta or Test environment. From my understanding, you should be able to remove the enrolments with Brian's overview above, and then if you were to re-enrol the students, their old information and submissions should re-appear in the gradebook etc.

As I said, I would strongly recommend testing this (and would be curious to hear your results).

Hope that helps!


 @stuart_ryan ‌ makes a good point. Canvas uses the term delete, but in all actuality it is marking the record as inactive so that it is no longer shown in the GUI. So if you do in the future need to re-enroll them into a course their old information will reappear.  

OOh good callout  @bneporadny ! Also I should have mentioned, if you use Canvas Data, inactivating will mean the records will be hidden from Canvas Data as well.

Community Contributor

Alternatively you could also use "completed" in the enrollments.csv, I'm not sure how this would affect Canvas Data but using completed will still show the courses in the students account under past enrollments. That way if you want to also remove students from the course who have say changed courses but still attend your district they can still see their past courses.

Community Coach
Community Coach

Hi  @trenton_tyler ,

We haven't heard back from you in a while, so I am going to mark this question as Assumed Answered, if you do still have any questions, please don't hesitate to jump back in and we can help you out again.