Personal tools
Home Webmaster Resources Zope/Plone Plone - Import Users from a CSV file

Plone - Import Users from a CSV file

The easiest method of importing users from a CSV file doesn't involve external methods or file system code.
Everything can be done right inside the ZMI, on your plone site:


  • Create the CSV file without any text delimitter (some software inserts single or double quotes around text, you'll need to remove those in a text editor, such as notepad).
  • The following code assumes the CSV columsn are as follows:  username, password, fullname, email
  • In the root of your plone site, go to 'Properties'
  • Add a new 'lines' field, call it temp
  • Copy and paste the entire contents of the CSV file into this lines field
  • Create a new Script (Python) with the following code:

out = []
pr = context.portal_registration

for item in context.portal_properties.temp:
  person = item.split(',')
  username = person[0]
  password = person[1]
  fullname = person[2]
  email = person[3]
  try:
    pr.addMember(id = person[0], password = password, roles = ["Member",], properties = { 'fullname': fullname, 'username': username, 'email': email, } )
  except ValueError, msg:
    out.append("Skipped %s, reason: %s" % (email, msg))

return out

Need assistance with your project? Universal Web Services can help.
Contact us to request a quote.