Bulk import of users and courses into Moodle

Loading users, courses and enrolments into a new self-hosted Moodle with the core upload tools, and deciding when a recurring LDAP or external database sync is the better fit.

On this page

Bulk import of users and courses into Moodle: what the move involves

A one-time load of user lists, course shells and enrolments into a new self-hosted Moodle is a data preparation job before it is a software job. The core CSV upload tools handle that load well when the source extract is a fixed snapshot. A recurring sync through LDAP or an external database enrolment plugin fits better when the source of truth keeps changing, for example when staff join, move or leave during the rollout and the learning platform must follow them without manual files. Most teams end up using both: a bulk load to establish the baseline, then an automated sync for ongoing membership.

The work divides into three parts: mapping the source fields to Moodle's upload columns, deciding how existing accounts are matched (usually by username, email or an ID number field), and agreeing who owns each enrolment after go-live. Teams should confirm the exact columns and options of the upload users and upload courses screens against the Moodle version they will run, because these change between releases. They should also decide early which role each enrolment method grants, whether course shells are created from a template, and who approves the file before it is applied. Each of these decisions changes the test plan.

Effort depends mainly on data quality and on the number of sources. A single clean export from one system with stable identifiers is a short exercise, while duplicate accounts, inconsistent department names or several HR and student information feeds that disagree multiply the cleaning and reconciliation work. Ask any partner to size the work from a sample extract, not from the target count of users, and to state which sources, matching rules and sync frequency the quote assumes.

Which source data maps cleanly into Moodle and which does not

This table compares common source objects with their Moodle core equivalent and notes where each one needs attention before import. Read the first column as the item in your source system, then check the middle column for where it lands in Moodle and the last column for what to rebuild or verify. The main takeaway is that identity and enrolment data usually moves across, while course content, grade history and passwords usually do not.

Source objectMoodle core equivalentMigration notes
User accountsUser records loaded with the upload users toolMap a stable unique identifier such as username or idnumber. Check for duplicate emails, which Moodle may reject depending on configuration.
Profile fieldsStandard user fields plus custom profile fieldsStandard fields such as first name, last name and email map directly. Anything else needs a custom profile field created first.
Custom user attributes without a profile fieldNone until a custom profile field is createdDo not load these silently. Create a matching custom profile field or decide to leave the data in the source system.
PasswordsPassword field in the user upload file, or an external authentication sourceMost systems do not export password hashes. Plan for new passwords, email-based password reset, or sign-in through LDAP, SSO or an external database.
CoursesCourse shells created with the upload courses toolThe upload tool creates course shells and settings only. Course content such as pages, files, quizzes and activities must come from backups or be rebuilt.
CategoriesCourse categoriesCreate the category tree first, then reference category IDs or idnumbers in the course file. Confirm the naming and nesting before loading.
Enrolments, roles and groupsCourse enrolments with role assignments, and groups within coursesEnrolment files reference users and courses by identifier. Map source roles to Moodle roles such as student and teacher. Groups need a separate step.
Cohorts and grade historyCohorts for audience membership; gradebook for gradesCohorts can be loaded as audiences. Historical grades and gradebook structure do not transfer through these tools and need a separate decision.

Documented Moodle core paths for loading users and courses

Moodle core offers several documented ways to put users, courses and enrolments into a new site without manual entry. Each path expects its own CSV layout and behaves differently when records change later, so the choice shapes both the migration and the ongoing data model. Confirm each path against the documentation for your target Moodle release before building files.

Upload users tool

The upload users tool creates accounts from a CSV file, with columns for username, authentication method, names, email and optional profile fields. Confirm which columns your target release accepts and how it treats existing usernames, since a mismatch can update or skip accounts you expected to create. Decide whether passwords are set in the file or whether users receive reset emails, because the file itself becomes sensitive data that needs controlled storage and deletion after use.

Moodle 5.1 notes

Upload courses tool

The upload courses tool creates or updates course shells from a CSV file, using short names, full names, categories, formats and start and end dates as columns. Check how it handles an existing short name, because course identifiers are the keys that later enrolment files depend on. Agree the category tree and naming convention before loading, since moving courses between categories after launch touches reporting and permissions.

Cohort and group uploads

Cohorts are site-wide or category-level groups of users, and the upload cohorts tool can create them and add members from a file. Groups inside a course are handled by a separate group upload path tied to a course identifier. Map which cohorts are reused across courses and which groups belong to one course, because cohorts often drive enrolments, so an error in a cohort file can enrol the wrong people in several courses at once.

Manual and file-based enrolment

The manual enrolment method holds enrolments that a teacher or administrator sets directly, and the upload course enrolments path writes those records from a file keyed on user and course identifiers. This path is the simplest to audit and suits one-off loads. It does not follow changes in a source system, so every later change needs another file run, and someone must own that process.

Cohort sync enrolment

The cohort sync method enrols every member of a chosen cohort into a course and keeps the enrolments aligned as cohort membership changes. It fits programmes where a fixed group of learners should always have the same course set. Plan the cohort naming and ownership model first, because the sync follows the cohort, not the other way round, and removing a user from a cohort will remove their course access in every linked course.

External database and LDAP enrolment

The external database enrolment and LDAP enrolment methods read membership from a system of record on a schedule, so the Moodle site stays in step with the source. Both need a read-only service account, agreed attribute and field mappings, and a test against a copy of the directory or database before go-live. Confirm the behaviour for removed or suspended source records, and whether Moodle should suspend or delete the enrolment, because that choice determines whether learners lose access or keep their history.

How the import, pilot, parallel run and cutover fit together

This sequence moves users, courses and enrolments from a source system into a self-hosted Moodle in controlled stages, so each load is proven before the next one touches live learners. The end result is a documented cutover with reconciled counts and a source system that can be safely retired.

  1. Inventory and profile the source data

    Before any file is written, list every source of users, courses, categories and enrolments, and profile the data: duplicate usernames, missing or shared email addresses, inconsistent case, retired accounts and courses with no owner. The project team, the data owner and the Moodle administrator review the profile together and agree which records are in scope for the first load. This step is done when each source has a named owner, a record count and a written list of known data defects with a decision on each.

  2. Design the mapping file and matching rules

    Define how each source column maps to a Moodle upload field, such as username, email, idnumber, course shortname, category path and role, and decide which field identifies a user across reloads. Agree the matching rule in writing, for example whether an existing account is matched on username, email or an institutional ID, and what happens when two rules disagree. Confirm the exact column names and accepted values against the upload users and upload courses documentation for your Moodle version. The mapping is done when a sample file of about a few rows loads without errors on a scratch site.

  3. Run a test import on a staging copy

    Load the full CSV set into a staging copy of the production Moodle database and moodledata, using the core upload users and upload courses tools with dry runs enabled where the interface offers them. Check the upload preview and the result report for skipped rows, updated accounts and created courses, and keep the log for every run. Confirm that no duplicate accounts were created by comparing the user count before and after against the matching rule. The step closes when a second run on the same files produces no unexpected creations, which shows the import is repeatable.

  4. Pilot with one category or department

    Import the users, courses and enrolments for a single category or department into the live Moodle, and let a small group of teachers and learners use it for real coursework. The Moodle administrator reconciles the pilot: the number of accounts in the file against the accounts in Moodle, enrolment counts per course against the source, and role assignments against the agreed design. Sign-in is tested for a sample of learners through the chosen authentication method. The pilot is complete when the reconciliation shows zero unexplained differences and the pilot group has signed off.

  5. Run both systems in parallel and compare

    For a defined period, keep the source system and the new Moodle both receiving the same changes, and compare them on a schedule. The comparison covers user counts by status, enrolment counts per course, course membership lists for a sample of courses and any grades or completions that have been agreed as in scope. Each mismatch is traced to a source record, a mapping rule or a process gap and fixed at the root, not patched by hand in one system. The parallel run ends when two consecutive comparisons show no unexplained differences, as agreed in the project plan.

  6. Cut over with a final delta load

    Freeze changes in the source system for a short agreed window, export only the records changed since the last full load, and apply that delta to Moodle using the same mapping file and matching rules. Repeat the reconciliation for users, courses and enrolments, and confirm that sign-in works for the full population through the production authentication method. Record the time of the freeze, the delta file checksums, the reconciliation results and the sign-off from the business owner. The cutover is complete when the reconciliation is clean and the source is marked read-only for users.

  7. Decommission the old source after a hold period

    Keep the source system in read-only mode for an agreed hold period so that teams can check historical records and raise any gaps. Archive the final export, the import logs, the mapping files and the reconciliation reports in a location the records and compliance owners can retrieve. Once the hold period ends and no open defects remain, remove the source's access for learners and staff, and retire its integrations, scheduled exports and service accounts. The step is complete when the archive is verified and the source has a documented shutdown record.

How source extracts flow into Moodle core tools or sync plugins

The diagram starts with HR, student information and spreadsheet extracts, which pass through a cleaning and mapping step that fixes identifiers and field names before any load. From there the data takes one of two paths: the one-time upload users and upload courses tools, or a recurring external database or LDAP enrolment sync. Both paths are rehearsed in a staging Moodle first, and only then applied to production. Check that each unique identifier matches across sources before loading.

Source extracts pass through cleaning and mapping, then staging, before production.

When a one-time CSV import is enough and when recurring sync fits better

A one-time CSV import is the right choice when the population is fixed and will not change much after go-live: a single cohort of learners, a closed migration from another system, or a set of staff accounts that a training team will manage by hand afterwards. The core upload users and upload courses tools handle this well for a bounded load, and the work ends when the file is loaded and checked. Recurring sync fits better when the people and enrolments change every term or every day, such as student intakes, contractor onboarding or course rosters pulled from a registry. In that case the core LDAP authentication and enrolment plugins, or the external database authentication and enrolment plugins, keep Moodle aligned with a directory or a system of record. Confirm how each plugin creates, updates and suspends accounts in the release notes for your Moodle version, because behavior around field mapping and suspension has changed between releases.

The first decision is who owns the source of truth. If HR, the student information system or the identity directory holds the authoritative record, Moodle should read from it and never be edited by hand for fields that the source controls. If the learning team is the owner, for example for external learners enrolled on a short course, a CSV file may remain the master and the import is the process. Write this down per field (name, email, cohort, role, course membership) before any file is built, because two systems writing to the same field produce conflicts that surface only after users report them.

Leavers need an explicit rule. Decide whether a user who disappears from the source is suspended, has enrolments removed, or is left alone, and how long a grace period lasts for learners who return after a break. Test the rule with a sample of accounts that should leave and accounts that should stay. Plan who approves deletion, how grades and submissions are retained for the period your policy requires, and how a suspended account is reactivated. Deprovisioning rules are much harder to add after go-live, when reports, gradebooks and audit trails already depend on the current behavior, so agree them with the registrar, HR and security team before the first live sync runs.

How the approach changes by hosting and identity setup

A small single-site Moodle that uses manual accounts usually has one identity source: the people you type or upload into Moodle. Bulk work is mostly the core Upload users tool and the Upload courses tool, run from the site administration area, with a CSV prepared in a spreadsheet and checked before upload. Passwords, email addresses and course shortnames are the fields that most often cause rejected rows, so the file layout is worth testing on a copy first.

  • Tools: Core upload users and upload courses, plus manual enrolment or the upload users option that enrols people into courses in the same file.
  • Identity dependency: None outside Moodle. Every account is created and maintained by hand or by file, so you own password resets and leavers.
  • Data owner: Usually a single administrator or a small team who keeps the source spreadsheet as the record of truth.
  • Recurring work: Each term or intake needs a new file and a review of accounts that should be suspended.
  • Confirm with the team: Who prepares the file, who approves it, and whether the email domain allows self-registration or should be closed.

Before relying on this route, confirm the authentication method and password policy you plan to use in your Moodle version, since these settings decide what a CSV row must contain.

What drives effort and cost in a user and course import

Most of the cost in a Moodle import sits in data preparation and decisions, not in the upload itself. The cards below show who carries each piece of work, which parts are one-time and which recur when the source systems keep changing.

Number and quality of source systems

Each source system that feeds users or courses adds an extraction job, a field mapping and a set of data quality checks. Student information systems, HR exports and spreadsheets maintained by departments often disagree on names, status codes and date formats. Your team or a partner is paid to profile these sources, agree which one is authoritative for each field, and write the transformation rules. Ask the quote to list every source, its owner and its update frequency, because a source that changes weekly turns a one-time load into a recurring job.

Duplicate and identifier conflicts

A user who appears twice with different usernames, or two accounts sharing one email address, will cause the upload to fail or merge the wrong people. Decide early which stable identifier keys each user (an employee or student number is usually safer than an email address) and how existing Moodle accounts are matched. This is a one-time cleanup with a recurring rule: the matching logic must still run on each later load. Confirm the matching rule with the data owner before any file is uploaded.

Custom profile fields

Fields such as cohort codes, department, line manager or contract type are stored as custom user profile fields in Moodle, and each one must exist before the upload can populate it. Designing these fields, naming them consistently and mapping source columns to them is design work paid once. Later changes to field names or validation rules affect every future import file, so ask who owns the field dictionary after go-live and how changes are tested.

Course structure design

Uploading courses only works if the shortname, category, format and start and end dates are settled in advance. A structure designed around departments, programs or terms is paid for once, but the templates and naming rules then govern every later term. Ask for a written course naming standard, a category tree and a decision on whether courses are created empty or from templates, since template content is often the largest effort item.

Enrolment rules and deprovisioning

Enrolments need a rule for who is enrolled, with which role, and when access ends. A one-time CSV can add people correctly and still leave leavers enrolled for years if no removal step exists. The choice between a scheduled file load, an external database enrolment or LDAP sync is a recurring cost decision: each option needs a source feed to be kept running, monitored and supported. Ask the quote to state who maintains that feed after the project ends.

Testing and reconciliation

Reconciliation compares the counts and attributes in the source with what Moodle holds after each load: users created, updated, suspended and enrolled, and courses created with the right categories. Preparing test files, running a dry load on a copy of production, and signing off the reconciliation report is paid work that should be scoped separately from the upload. Ask for a test plan listing the sample sizes, the owners who sign off, and whether the same reconciliation will be repeated for each term.

Questions buyers ask before importing users and courses into Moodle

Can our own team run the user and course import without a partner?

Yes, if you have a Moodle administrator who can prepare clean CSV files and test on a copy of the site first. The core upload users and upload courses tools are part of Moodle core, so no plugin is needed for a one-time load. The work that usually stalls internal teams is not the upload itself but agreeing the source data, mapping fields, handling duplicates and checking results against the enrolment rules for each course. A partner adds value when the data comes from several systems, when the import must be repeated across environments, or when you want the process documented for audit. Confirm your team's capacity before deciding.

What does the cost of a user and course import depend on?

Cost follows the amount of work in preparing and checking the data, not the upload tool. The main drivers are the number of source systems, how many records have conflicting or missing identifiers, whether course structures must be designed before loading, and how many test loads are needed in a staging site. A one-time load into a new site costs less than a repeated process that must run each term. Ask any provider for a quote that lists data profiling, mapping, test runs, the production load, verification and handover as separate lines, and say who maintains the CSV templates afterwards.

How long does a bulk import take, and what slows it down?

Duration depends mainly on data quality and the number of decisions that must be made by people outside the project. Clean files with stable identifiers can be tested in a few cycles, while records with duplicate emails, unclear course ownership or inconsistent names add rounds of review. Upload runtime itself depends on file size and server capacity, so test with a full-sized file on a staging copy of your hosting stack. No general duration is given here; ask for a schedule tied to your number of source systems and the sign-off steps your organization requires.

What do we need from HR or the registrar's team before importing?

You need an authoritative source for who should have an account, the identifier that will be unique across the site, and the course enrolments that match each person's role. Typically this means a current staff or student extract with a stable employee or student number, email address, first and last name, and department or cohort. HR or registrar teams should also confirm leavers, the rule for role changes, and who approves access to restricted courses. Without these decisions, the import will reproduce errors from the source. Agree on the extract format and refresh schedule before the first load.

Do passwords transfer when users are imported into Moodle?

Usually not in a plain CSV import. The upload users tool can create accounts with a generated or set password, and you can choose to force a password change at first sign-in, but you should not expect existing passwords from another system to carry over. For organizations that already hold credentials in a directory, the better route is usually to keep authentication in that directory, using the LDAP or external database authentication that Moodle core ships, so users sign in with their existing credentials. Confirm with your identity team which system is the source of truth before choosing.

When should we use a recurring sync instead of a one-time import?

Choose a recurring sync when user or enrolment data changes often and another system already holds the authoritative record. Moodle core provides the external database and LDAP enrolment and authentication plugins, which can keep accounts and course memberships aligned with a source without repeated manual uploads. A one-time CSV import fits a new site, a single cohort, or a migration cutover where the data is frozen. If you will repeat the upload every term, the maintenance cost of a manual process usually justifies a sync. Test how the sync handles removed records before enabling it, because deletion and suspension rules deserve as much care as creation.

Which Moodle version and server requirements affect the import plan?

The import plan depends on the Moodle release you install, because it sets the PHP and database versions your staging and production hosts must run. For example, Moodle 5.3 requires 64-bit PHP 8.3 or later (8.4 supported), PostgreSQL 17, MySQL 8.4, MariaDB 11.4 or SQL Server 2019 or later, and sites must run Moodle 4.4 or later to upgrade. Confirm the exact requirements in the Moodle 5.3 release notes before building the environment, and make sure the import is rehearsed on the same version you will run in production.

What usually goes wrong in user and course imports

Most failed Moodle imports do not fail loudly. They create duplicate accounts, enrol the wrong people, or leave old access switched on, and the problems surface weeks later. The cards below cover the risks we see most often, each with the check that prevents it.

Duplicate accounts from inconsistent identifiers

Moodle matches an uploaded user to an existing account using the username, and usernames are often built differently across source systems. A learner exported as jsmith in the HR feed and as john.smith in the old LMS will be created twice, and both accounts will receive enrolments. Before any upload, pick one stable identifier, such as a staff or student number, normalize its format, and run a dry check of the CSV against the live user table to find near-matches.

Enrolments that do not match source records

A course enrolment file is only as accurate as the list of courses and roles it references. Shortnames that differ by one character, roles typed in the wrong case, or enrolment rows pointing at users created in a failed earlier run produce memberships that look correct in a spreadsheet and are wrong in Moodle. Reconcile enrolment counts per course against the source system and sample a set of learners in each course before release.

Password and login method mismatch

A CSV upload sets passwords or leaves them for a forced reset, and the authentication method on each account decides how sign-in actually works. Accounts uploaded with the manual method will not sign in through LDAP or an identity provider, and accounts created with a plain password may remain valid after the organization expects single sign-on only. Agree the auth method per user group in writing, test one account from each group, and confirm that no temporary passwords are exported into shared files.

Course content that was never exported

Courses are often rebuilt from a list of shortnames and the team assumes the content came along with them. Activities, question banks, files and gradebook settings only move if someone created a course backup in the source system and restored it into Moodle. Build an inventory of source courses, confirm which have a backup file, and record any course that must be rebuilt by hand so the gap is planned rather than discovered by teachers during term.

Leavers left active

A one-time import adds people but rarely removes them. Staff and students who left the source system keep working accounts and course access in Moodle unless a separate step suspends them. Define the rule for suspension, such as a leaver flag or end date in the source feed, and run it as part of every load so old accounts do not remain reachable after the source has moved on.

Cutover without a delta load

Teams often load a snapshot a week or more before go-live and then switch over without reloading. Every enrolment, name change and new hire made in the source during that gap is missing or stale in Moodle. Plan a final delta load on cutover day, compare the counts and changes against the snapshot, and decide whether the recurring sync through external database or LDAP enrolment should take over from that point.

How DeployOpen scopes and delivers a Moodle import

DeployOpen starts with a written scope that names the source files, the target Moodle version and the rules that decide who gets which account, course and enrolment. The scope document lists each CSV or data feed, the owner who signs off its contents, the fields mapped to Moodle profile fields and course metadata, and the decisions still open, such as how to match existing accounts, which authentication method new users receive and whether a course shell is created empty or populated. Deliverables, the test environment and the acceptance criteria are agreed before any file is touched. Confirm the target version and its server requirements with your own infrastructure team before the scope is signed, because the Moodle release you run sets the PHP and database versions the import environment must match.

The mapping and test cycles run on a copy of your Moodle inside your own infrastructure, never on production. DeployOpen builds the mapping in the upload tools, runs each file in preview mode, reviews the errors and reruns until the preview is clean, then loads the same files into a test site and checks a sample of accounts, enrolments and course categories against the source records. Each cycle produces a log that your team can read, and the mapping and rules are version-controlled so a change can be traced. Where the import will later be replaced by an external database or LDAP enrolment, the same mapping is tested against that feed to show the two agree.

The pilot loads one department or cohort into production, and a parallel run keeps the old source active while staff and learners check their accounts, course access and enrolments. DeployOpen hands over the mapping and transform rules, the runbook for re-running an import, the rollback steps, the test evidence and a list of known exceptions, so your team can repeat the process for the full load and for later batches. Support after handover is quoted separately as a retainer or a bounded follow-up, and the handover pack records who owns each file and each sign-off.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.