how do I create a csv file listing all teacher?

Jump to solution
KentKersey1
Community Explorer

how do I create a csv file listing all teacher?

Labels (1)
1 Solution
James
Community Champion

@KentKersey1 

While @chriscas is waiting for you to get back, I'll go ahead and give an answer to one of the things you might want. When you see the complexity of the answers (and I'm only answering one), you may understand why he asked for clarification.

If you would like to export a list of all of the teachers for all courses and have full admin rights, you can go to your Admin > Settings page. Choose the Reports tab. The Provisioning report will allow you to export information about your instance, but it comes in a way that you probably don't want (unless you understand databases and normalized tables).

  • The Enrollments CSV will contain a list of all enrollments. This file will let you know whether an enrollment is a student enrollment or a teacher enrollment. It's going to be necessary to get just the list of teachers. However, it contains only Canvas IDs and not nice names like "John Smith" or "Math 101".
  • The Users CSV will allow you to link the user IDs from the Enrollments CSV to nice user names like "John Smith".
  • The Courses CSV will allow you to link the course IDs from the Enrollments CSV to nice course names like "Math 101"

You now need to merge the information that you need together into a single file. How to do that is beyond this response when we're not sure if this is even what you're after.

 

If you have a Student Information System, the information may require less work to get from there than from Canvas. Your institution probably has someone who manages that who could generate a report for you.

 

A third option is to ask the GraphQL interface for the data. Canvas has said that they will start enforcing pagination limits on the GraphQL requests, but as of January 18, 2025, they still haven't done that so you can get all teachers for all courses as long as the request doesn't take too long. I'm including a script that will give you all of the teachers for a specific term as a request for all teachers for all courses from all time will probably be too long and timeout.

To use this, add /graphiql to the end of your main Canvas instance (your dashboard) URL.

Copy/paste this into your code window and then change the sisId on line 2 to match yours. Our Spring 2025 term is "2025a". If you don't have SIS IDs for your term, you can change it to "id" and put in the Canvas term ID. You might also need to change line 10 to use their Canvas ID rather than their SIS ID.

query instructorsByTerm {
  term(sisId: "2025a") {
    coursesConnection {
      nodes {
        _id
        name
        enrollmentsConnection(filter: {types: TeacherEnrollment, states: active}) {
          nodes {
            user {
              _id
              sortableName
            }
          }
        }
      }
    }
  }
}

Now execute the command with the big triangle inside a circle at the top. It will take a while and may timeout if you are a large institution.

On the right panel, you'll get the results, which are a JSON object that starts with data, term, coursesConnection, and nodes. After "nodes" there is left square bracket. Select all of the data starting with the left bracket through the bottom where you will see a right bracket. Include both brackets, but not the stuff before or after them (don't include the four curly braces at the end).

Copy that data to your clipboard.

Now go to a site that will convert JSON to CSV. I've linked to the one at ConvertCSV, which works well for me and the conversion is done in-browser, whereas some other sites send the information to a server out of country for processing and that's a concern for some people.

You can then download the result as a CSV file. There is a JSON to Excel file, but it converts numbers to strings, so I tell my students to not use that option.

View solution in original post