diff --git a/nbgrader/apps/exportapp.py b/nbgrader/apps/exportapp.py
index 0c343861..a4417107 100644
--- a/nbgrader/apps/exportapp.py
+++ b/nbgrader/apps/exportapp.py
@@ -9,7 +9,10 @@ aliases = {
     'log-level' : 'Application.log_level',
     'db': 'CourseDirectory.db_url',
     'to' : 'ExportPlugin.to',
-    'exporter': 'ExportApp.plugin_class'
+    'exporter': 'ExportApp.plugin_class',
+    'assignment' : 'ExportPlugin.assignment',
+    'student': 'ExportPlugin.student',
+
 }
 flags = {}
 
@@ -32,6 +35,16 @@ class ExportApp(NbGrader):
 
             nbgrader export --to mygrades.csv
 
+        You can export the grades for a single (or limited set) of students 
+        or assignments with the --assignment and/or --student flag:
+
+            nbgrader export --assignment [assignmentID] 
+                            --student [studentID1,studentID2]
+
+        Where the studentIDs and assignmentIDs are a list of IDs and 
+        assignments. The assignments or studentIDs need to quoted if they 
+        contain not only numbers. The square brackets are obligatory.
+
         To change the export type, you will need a class that inherits from
         nbgrader.plugins.ExportPlugin. If your exporter is named
         `MyCustomExporter` and is saved in the file `myexporter.py`, then:
diff --git a/nbgrader/plugins/export.py b/nbgrader/plugins/export.py
index 93ff6e01..26896cd5 100644
--- a/nbgrader/plugins/export.py
+++ b/nbgrader/plugins/export.py
@@ -1,4 +1,4 @@
-from traitlets import Unicode
+from traitlets import Unicode, List
 
 from .base import BasePlugin
 from ..api import MissingEntry
@@ -9,6 +9,12 @@ class ExportPlugin(BasePlugin):
 
     to = Unicode("", help="destination to export to").tag(config=True)
 
+    student = List([],
+        help="list of students to export").tag(config=True)
+
+    assignment = List([],
+        help="list of assignments to export").tag(config=True)
+
     def export(self, gradebook):
         """Export grades to another format.
 
@@ -35,7 +41,24 @@ class CsvExportPlugin(ExportPlugin):
         else:
             dest = self.to
 
+        if len(self.student) == 0:
+            allstudents = []
+        else:
+            # make sure studentID(s) are a list of strings
+            allstudents = [str(item) for item in self.student]
+
+        if len(self.assignment) == 0:
+            allassignments = []
+        else:
+            # make sure assignment(s) are a list of strings
+            allassignments = [str(item) for item in self.assignment]
+
         self.log.info("Exporting grades to %s", dest)
+        if allassignments:
+            self.log.info("Exporting only assignments: %s", allassignments)
+
+        if allstudents:
+            self.log.info("Exporting only students: %s", allstudents)
 
         fh = open(dest, "w")
         keys = [
@@ -57,11 +80,19 @@ class CsvExportPlugin(ExportPlugin):
         # Loop over each assignment in the database
         for assignment in gradebook.assignments:
 
+            # only continue if assignment is required
+            if allassignments and assignment.name not in allassignments:
+                continue
+
             # Loop over each student in the database
             for student in gradebook.students:
 
-                # Create a dictionary that will store information about this
-                # student's submitted assignment
+                # only continue if student is required
+                if allstudents and student.id not in allstudents:
+                    continue
+
+                # Create a dictionary that will store information 
+                # about this student's submitted assignment
                 score = {}
                 score['assignment'] = assignment.name
                 score['duedate'] = assignment.duedate
@@ -71,10 +102,10 @@ class CsvExportPlugin(ExportPlugin):
                 score['email'] = student.email
                 score['max_score'] = assignment.max_score
 
-                # Try to find the submission in the database. If it doesn't
-                # exist, the `MissingEntry` exception will be raised, which
-                # means the student didn't submit anything, so we assign them a
-                # score of zero.
+                # Try to find the submission in the database. If it
+                # doesn't exist, the `MissingEntry` exception will be
+                # raised, which means the student didn't submit 
+                # anything, so we assign them a score of zero.
                 try:
                     submission = gradebook.find_submission(
                         assignment.name, student.id)

Allow the exporting of grades per assignment id
The main issue I have with the exporting of grades (csv export) is that it is extremely sluggish exporting the entire gradebook (5min+), especially in cases where there may only be one or two grade changes for a given assignment.

My suggestion is to allow the exporting of grades to individual files per assignment id, if an assignment id is specified, otherwise export the entire gradebook.

A custom plugin can be created to achieve this, but I think it may be better to support this.
@jhamrick what do you think?

This is also something that is specific to the use case of a large number of students.
diff --git a/nbgrader/tests/apps/test_nbgrader_export.py b/nbgrader/tests/apps/test_nbgrader_export.py
index 9f56ff92..5d107248 100644
--- a/nbgrader/tests/apps/test_nbgrader_export.py
+++ b/nbgrader/tests/apps/test_nbgrader_export.py
@@ -44,3 +44,21 @@ class TestNbGraderExport(BaseTestApp):
 
         run_nbgrader(["export", "--db", db, "--exporter=nbgrader.tests.apps.files.myexporter.MyExporter", "--to", "foo.txt"])
         assert os.path.isfile("foo.txt")
+
+        run_nbgrader(["export", "--db", db, "--student", "['bar']"])
+        assert os.path.isfile("grades.csv")
+        with open("grades.csv", "r") as fh:
+            contents = fh.readlines()
+        assert len(contents) == 3
+
+        run_nbgrader(["export", "--db", db, "--assignment", "['ps1']"])
+        assert os.path.isfile("grades.csv")
+        with open("grades.csv", "r") as fh:
+            contents = fh.readlines()
+        assert len(contents) == 3
+
+        run_nbgrader(["export", "--db", db, "--assignment", "['ps1']", "--student", "['foo']"])
+        assert os.path.isfile("grades.csv")
+        with open("grades.csv", "r") as fh:
+            contents = fh.readlines()
+        assert len(contents) == 2

pip install -e .[dev]
parse_log_pytest
requirements.txt
pyenchant sphinxcontrib-spelling sphinx_rtd_theme nbval pytest
apt-get update apt-get install -y gcc
3.5
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
alembic==1.7.7
anyio==3.6.2
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
async-generator==1.10
attrs==22.2.0
Babel==2.11.0
backcall==0.2.0
bleach==4.1.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
comm==0.1.4
contextvars==2.4
coverage==6.2
dataclasses==0.8
decorator==5.1.1
defusedxml==0.7.1
docutils==0.18.1
entrypoints==0.4
fuzzywuzzy==0.18.0
greenlet==2.0.2
idna==3.10
imagesize==1.4.1
immutables==0.19
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
ipykernel==5.5.6
ipython==7.16.3
ipython-genutils==0.2.0
ipywidgets==7.8.5
jedi==0.17.2
Jinja2==3.0.3
json5==0.9.16
jsonschema==3.2.0
jupyter==1.1.1
jupyter-client==7.1.2
jupyter-console==6.4.3
jupyter-core==4.9.2
jupyter-server==1.13.1
jupyterlab==3.2.9
jupyterlab-pygments==0.1.2
jupyterlab-server==2.10.3
jupyterlab_widgets==1.1.11
Mako==1.1.6
MarkupSafe==2.0.1
mistune==0.8.4
nbclassic==0.3.5
nbclient==0.5.9
nbconvert==6.0.7
nbformat==5.1.3
-e git+https://github.com/jupyter/nbgrader.git@48721e9a605aa785aa0916e2049f60b50d26e70e#egg=nbgrader
nbval==0.10.0
nest-asyncio==1.6.0
notebook==6.4.10
packaging==21.3
pandocfilters==1.5.1
parso==0.7.1
pexpect==4.9.0
pickleshare==0.7.5
pluggy==1.0.0
prometheus-client==0.17.1
prompt-toolkit==3.0.36
ptyprocess==0.7.0
py==1.11.0
pycparser==2.21
pyenchant==3.2.2
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
pyzmq==25.1.2
requests==2.27.1
Send2Trash==1.8.3
six==1.17.0
sniffio==1.2.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-spelling==7.7.0
SQLAlchemy==1.4.54
terminado==0.12.1
testpath==0.6.0
tomli==1.2.3
tornado==6.1
traitlets==4.3.3
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
webencodings==0.5.1
websocket-client==1.3.1
widgetsnbextension==3.6.10
zipp==3.6.0

name: nbgrader
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - alembic==1.7.7
      - anyio==3.6.2
      - argon2-cffi==21.3.0
      - argon2-cffi-bindings==21.2.0
      - async-generator==1.10
      - attrs==22.2.0
      - babel==2.11.0
      - backcall==0.2.0
      - bleach==4.1.0
      - cffi==1.15.1
      - charset-normalizer==2.0.12
      - comm==0.1.4
      - contextvars==2.4
      - coverage==6.2
      - dataclasses==0.8
      - decorator==5.1.1
      - defusedxml==0.7.1
      - docutils==0.18.1
      - entrypoints==0.4
      - fuzzywuzzy==0.18.0
      - greenlet==2.0.2
      - idna==3.10
      - imagesize==1.4.1
      - immutables==0.19
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - ipykernel==5.5.6
      - ipython==7.16.3
      - ipython-genutils==0.2.0
      - ipywidgets==7.8.5
      - jedi==0.17.2
      - jinja2==3.0.3
      - json5==0.9.16
      - jsonschema==3.2.0
      - jupyter==1.1.1
      - jupyter-client==7.1.2
      - jupyter-console==6.4.3
      - jupyter-core==4.9.2
      - jupyter-server==1.13.1
      - jupyterlab==3.2.9
      - jupyterlab-pygments==0.1.2
      - jupyterlab-server==2.10.3
      - jupyterlab-widgets==1.1.11
      - mako==1.1.6
      - markupsafe==2.0.1
      - mistune==0.8.4
      - nbclassic==0.3.5
      - nbclient==0.5.9
      - nbconvert==6.0.7
      - nbformat==5.1.3
      - nbval==0.10.0
      - nest-asyncio==1.6.0
      - notebook==6.4.10
      - packaging==21.3
      - pandocfilters==1.5.1
      - parso==0.7.1
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pluggy==1.0.0
      - prometheus-client==0.17.1
      - prompt-toolkit==3.0.36
      - ptyprocess==0.7.0
      - py==1.11.0
      - pycparser==2.21
      - pyenchant==3.2.2
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pyrsistent==0.18.0
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyzmq==25.1.2
      - requests==2.27.1
      - send2trash==1.8.3
      - six==1.17.0
      - sniffio==1.2.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-rtd-theme==2.0.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - sphinxcontrib-spelling==7.7.0
      - sqlalchemy==1.4.54
      - terminado==0.12.1
      - testpath==0.6.0
      - tomli==1.2.3
      - tornado==6.1
      - traitlets==4.3.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - wcwidth==0.2.13
      - webencodings==0.5.1
      - websocket-client==1.3.1
      - widgetsnbextension==3.6.10
      - zipp==3.6.0
prefix: /opt/conda/envs/nbgrader

nbgrader/tests/apps/test_nbgrader_export.py::TestNbGraderExport::test_export
nbgrader/tests/apps/test_nbgrader_export.py::TestNbGraderExport::test_help
nbgrader/plugins/export.py nbgrader/apps/exportapp.py
nbgrader/plugins/export.py nbgrader/apps/exportapp.py