Open menu
Close menu

CSV Import

CSV Import

Import Users and credentials into the system from a CSV file. This is useful for migrating user data from existing sites or bulk update operations.

To get a feel for the format you can get your hands on an example .csv file by clicking Export CSV from the Users page to export your own Users configuration

Format

id, name, details, enabled, groupNames, pins, cards


  • id - Leave blank to insert a new User, use the ID of an existing User to update that User
  • name - Name of the user.
  • details - (optional) Text field that allows you to add some notes or extra information about the user.
  • enabled - 1 = User is enabled, 0 = User is disabled
  • groupNames - Names of the User Groups you'd like to assign the User to.
    The User Group must exist in the configuration database before performing the import.
    i.e. new groupNames will not create a new User Group.
  • pins - PINs to assign to the User. Must be unique across the configuration database (unless it is an existing disabled PIN).
  • cards - Card codes to assign to the User. Must be unique across the configuration database (unless it is an existing disabled Card ).

Note that groupNames, pins, and cards fields accept either a single entry, or a comma-separated list enclosed in double quotes such as "employee,researcher"


Examples

Column Examples
id Insert: (blank) Update: 5,
name Jason
details No details: (blank) Update: Office manager,
enabled Enabled: 1 Disabled: 0
groupNames Single: employee, Multiple: ,"employee,researcher",
pins Single: ,4567, Multiple: ,"4567,9122",
cards Single: ,0092::770, Multiple: ,"0092::770,0092::771",

Validation

In order to import user data safely and maintain the data integrity of your site's configuration, the DN4 validates your data before inserting it into the configuration database.

Constraints that are validated:

  • PINs cannot be in use by other users in the config
  • Cards cannot be in use by other users in the config
  • User Groups with specified names must already exist in the config
  • When updating Users by specifying an ID, that ID must exist in the config
  • Names must be unique in the config
  • PIN/Cards cannot be duplicated in the CSV

Errors will be reported back to you such that you can modify the CSV and try importing again. This means that you can't accidentally import partial data or erroneous data and then have to track down these instances to make a decision on how to resolve the conflict or missing data.