I have a csv file of users and I would like to use the "drush user-create" command to create an account with these users and have them blocked by default with no password.

I noticed that there is a --pipe option, but I'm unsure how to use this with drush user-create to consume a csv file.

My csv file is just an email and the state:

[email protected],ny
[email protected],nj
[email protected],oh
[email protected],wy
  • 1
    You should consider using the migrate module for this purpose.
    – Eyal
    Commented Jun 9, 2016 at 22:35

1 Answer 1


It works with this:

awk -F "," '{cmd="drush -y ucrt " $1 ">> output"; system(cmd)}' users.csv

But it wouldn't work if you have thousands of users as it takes at least a second to create one. And also I can't seem to see the output when the user account is created. Not sure why "output" isn't working. But overall it works if you need to do it like that.

  • -F stands for field separator
  • The single quote starts the awk language
  • cmd is the command variable u designate
  • system is where you run the variable cmd
  • users.csv is the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.