Import Users via CSV

I know there is a ‘frontend’ way to invite users via CSV, however that will not work in my case, as it will send an email to the thousands of people who will be added to the site.

When trying to add it via the CLI, I get the following errors.

/var/www/discourse# rails runner script/import_scripts/csv_importer.rb /var/www/discourse/tmp/users.csv
Loading existing groups…
Loading existing users…
Loading existing categories…
Loading existing posts…
Loading existing topics…
File doesn’t exist: /var/www/discourse/tmp/emails.csv
File doesn’t exist: /var/www/discourse/tmp/custom_fields.csv
bundler: failed to load command: script/rails (script/rails)
/var/www/discourse/script/import_scripts/csv_importer.rb:29:in initialize': undefined method headers’ for nil (NoMethodError)

@imported_custom_fields_names = @imported_custom_fields.headers.drop(1)
                                                       ^^^^^^^^

Any thoughts on what could be going on?

This script is a migration script, it’s not intended for doing the singular task of adding users.

Do you just want to create a larger number of real user accounts, or are they for testing?

Aha! I saw importer, not migration! Thanks for the tip.

I want to import a large amount of users via CSV