The only check you want to watch out for is if the email already exists (you don't want two users with the same email, that's a check Drupal does when you create a new user interactively).<div><br></div><div>Forage for the code in the user.module.</div>
<div><br></div><div>Victor Kane</div><div><a href="http://awebfactory.com.ar">http://awebfactory.com.ar</a><br><br><div class="gmail_quote">On Wed, Dec 2, 2009 at 8:08 PM, Matt West <span dir="ltr"><<a href="mailto:mjw@our-hometown.com">mjw@our-hometown.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Gastón,<br>
<br>
You can do this programmatically by creating a separate script that bootstraps Drupal. Something like:<br>
<br>
if (($handle = fopen("file.csv", "r")) !== FALSE) {<br>
while (($data = fgetcsv($handle)) !== FALSE) {<br>
// Set vars to the appropriate indexes from the .csv, you'll need to customize this<br>
list($user, $pass, $mail) = $data;<br>
<br>
// Create the user array<br>
$new_user = array(<br>
'name' => $user,<br>
'pass' => $pass,<br>
'mail' => $mail,<br>
'status' => 1,<br>
'init' => $mail,<br>
);<br>
<br>
if(!user_load($new_user)) { // Make sure the user doesn't already exist<br>
// If you want to assign a role<br>
$roles = user_roles();<br>
$new_user['roles'] = array(array_search('your_roll_name', $roles) => 1);<br>
<br>
// Save the user<br>
$new_user = user_save(null, $new_user);<br>
}<br>
}<br>
fclose($handle);<div><div></div><div class="h5"><br>
}<br>
<br>
<br>
<br>
On Dec 2, 2009, at 5:38 PM, Gastón Pablo Pérez wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all<br>
<br>
I have data for several persons in an excel file and i would like to convert all of these people in users in my drupal 6. Somebody knows how can i do this? The idea is that not to have to create the users one by one, maybe i would have to make an sql script to include the users in one time, but i don't know in which tables I have to include the data and some other things for example, how have i to set the password? (this is encrypted in the database field)<br>
</blockquote>
<br>
<br></div></div><font color="#888888">
--<br>
Matt West<br>
Software Developer<br>
Our Hometown, Inc<br>
<a href="mailto:mjw@our-hometown.com" target="_blank">mjw@our-hometown.com</a><br>
<br>
</font></blockquote></div><br></div>