Import users from csv

AI-generated summary

The discussion revolves around importing users from a CSV file into Discourse. michaeltcoelho is experiencing issues with a rake script, resulting in a NoMethodError. They shared the script and CSV column structure (email;name;username;tile;groups). jomaxro suggested using the bulk invite tool, but it won’t work with the provided CSV columns. jomaxro further clarified that the API or rake task would be required, but couldn’t assist with implementation. michaeltcoelho attempted using the API but encountered rate limiting issues and found an existing script that isn’t working as expected.

Hi there,

i’ve exported users from my blog into a csv. Trying to import on discourse through a rake script i’m getting the following error:

NoMethodError: undefined method `bio_raw_will_change!' for nil:NilClass
/var/www/discourse/lib/promotion.rb:57:in `change_trust_level!'
/var/www/discourse/app/models/user.rb:757:in `change_trust_level!'
/var/www/discourse/app/services/trust_level_granter.rb:13:in `grant'
/var/www/discourse/app/services/trust_level_granter.rb:8:in `grant'
/var/www/discourse/app/models/group_user.rb:73:in `grant_trust_level'

Here is the script:

Anyone could help me on this?

it would be very nice if i could a reset password email to each user. if i do it am i going to get rate limited?

** Sorry but i’m not a ruby dev…

What is the content of the CSV? Are you importing more than just emails and groups? Sending bulk user invites might work if you’re simply trying to get users onto the site and into certain groups.

Hey @jomaxro, these are the columns:

email;name;username;tile;groups

Yeah, that’s more than the bulk invite tool will work with. You’ll need to get your rake task working, or use the API. Unfortunately I can’t assist with that.

I tried by API but, it gets rate limited. I got this script on GitHub - vindia/discourse_user_importer: A tiny script to import users from a CSV file into Discourse · GitHub, but it’s not working as i’ve described on this thread.