User CSV Import
This module imports user fields from a CSV file and creates a new user account with the information contained in the file. In addition, it lets you select which fields to import.
Most field types that comes with the Drupal core can be imported, with the exception of "Image" and "Taxonomy term".
- For a full description of the module, visit the project page.
- To submit bug reports and feature suggestions, or to track changes, use the issue queue.
Contents Of This File
- Requirements
- Recommended modules
- Installation
- Configuration
- Structure of the CSV
- Maintainers
Requirements
This module requires no modules outside of Drupal core.
Recommended modules
-
Advanced Help:
When this module is enabled, the project'sREADME.md
will be displayed when you visit/help/ah/user_csv_import/README.md
.
Installation
Install as you would normally install a contributed Drupal module. Visit Installing modules for further information.
After the module is installed, rebuild the cache.
Configuration
Once you have installed the module, a new button will appear on the People administration page with the name "+ Import users from CSV".
By clicking on the button you will be redirected to a form where you can upload the CSV file and configure the following options:
- The role or set of roles that will be applied to the new users that are created. Authenticated user is mandatory.
- The separation character (e.g. ";" if you're using a French version of MS Excel).
- The default password.
- The initial status of the imported users.
- Whether to notify the new user by email.
- The fields of the User entity that may be filled with the data extracted from the CSV file. The fields Name and Email will are mandatory.
There is also a checkbox named "Save configuration". Check it to save the urrent settings when you click "Import users". This saves you from having to re-enter them the next time you import users.
Passwords can be set in different ways:
-
You can set a Default password on the import form that will be applied to all imported users unless overridden. You need to change this into something only you know, because all imported accounts will be set up with this password unless it is overridden in the CSV. Even if you notify the new user by mail, the account will have this password until the user changes it.
-
If the user is notified by email, the default welcome email will send a one time log in url link. This would allow the new users to log in to set their own password. To examine the template for the welcome email that is send, navigate to Manage » Configuration » People » Account settings and look up: "Welcome (new user created by administrator)".
-
You may checkmark the Password field and provide an unique cleartext password in the CSV for each user. It will be encrypted when saved in the database. Any unpopulated 'pass' field in the CSV-file will be set to the Default password.
Structure of the CSV
In the first row, each column will contain the machine name of the field where you want to store the value. In Drupal, field machine names are always lower case. In the following rows, but following the same pattern of columns, the values will be stored.
For example, if the following five fields exist:
name
mail
field_first_name
field_last_name
field_phone
to import two example users with these fields, the CSV-file may look like this:
name,mail,field_first_name,field_last_name,field_phone
john,hohn@example.com,John,Smith,123-123-1234
jane,jane@esample.com,Jane,Doe,123-123-4567
The fields name
and mail
are defined by core. Additional fields
may be added to the user entity by navigating to Manage »
Configuration » People » Account settings » Manage fields.
You can see all fields that can be imported near the bottom of the "Import users" form, in the section titled "Select fields to import". This also tells you what the machine name of the fields are.