Import Many Users



I am new to OwnCloud err I mean NextCloud (I like where the Nextcloud project is going and its attitude)

I want to import multiple users at once, is there a way to do this say with a CSV files?

[Help][Question] Import users from vcard

Not really, but there is a console command ./occ user:add which you can call from a bash script which loops over the csv


Thank Might be too difficult for me, I guess its manual for me or perhaps the contact app can do this?



Unless you already have such a script you would be willing to share


I would like to push this feature request again!
I also have a large number of users to add which I store as excel-sheet at the moment, so the import of csv files would be nice! Also the possibility to sync between the contacts app and the user list would be really nice!

Maybe it’s possible to import csv files to the contacts app an sync them to the user list?



This is a feature I also badly needed as I have about 200 users to create! I have previously had sucess with excel macros that work with Internet Explorer to complete fields in online forms, and, realising that the NEXTCLOUD admin pages are essentially web pages with forms, I thought I would try the same method…

I was delighted to discover that it worked :slightly_smiling_face:

At the bottom of this post is the code required for the excel macro.
NOTE the script will fail if your passwords do not meet your NEXTCLOUD minimum password policy!

When creating your own macro in an excel workbook …

enter usernames in column A
enter passwords in column B

update the URL of the your NextCloud hosting within the code

Run macro

Here follows the code
This needs to go into a module - see
for some basic instructions

Have fun!

Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
            (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWNORMAL = 1

Public Function Nz(ByVal Value, Optional ByVal ValueIfNull = "")
    Nz = IIf(IsNull(Value), ValueIfNull, Value)
End Function

' Tested with Office 2010 and NextCloud 10

Sub CreateUsersAndPasswordsNextCloud()
Dim IE As Object
Dim usercount As Integer

Set IE = CreateObject("internetexplorer.application")
IE.Visible = 1
apiShowWindow IE.hwnd, SW_MAXIMIZE
    With IE
    'Replace the URL below with your NEXTCLOUD address - don't forget the / at the end!
    .Navigate ""

    ' Waits for i.e. to become ready
    Do While IE.ReadyState = 4: DoEvents: Loop   'Do While
    Do Until IE.ReadyState = 4: DoEvents: Loop   'Do Until

    .Visible = False
    .Visible = True
End With
MsgBox "Manually select the desired group your new users will belong to and left click in the Username field"
With IE
usercount = 1
Do While Nz(Sheet1.Cells(usercount, 1), "") <> ""
'the Application.Wait line ensures that there is enough time for the sendkeys command to execute
'to speed up the script you can try commenting out these lines
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys Sheet1.Cells(usercount, 1)
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "{TAB}"
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys Sheet1.Cells(usercount, 2)
Application.Wait (Now + TimeValue("0:00:01"))
'Application.SendKeys "{TAB}"hbriggs 1209865hdg

'Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "{RETURN}"
Application.Wait (Now + TimeValue("0:00:01"))

'moves to next user password pair
usercount = usercount + 1

MsgBox "Completed!"

End With
End Sub


Can you share the ready excel file with macros inside
And how about Display Name on same excel file, email ?
I need to add more columns in sheet of excel file?

And please tell me is possible to run on Firefox,Chome or other browser.



I’m looking for a feature to create bulk users from Admin panel in Nextcloud 15. Or can you please share the ready excel file with macros inside?
And how about Display Name on same excel file, email?



We have solved such a problem with connecting Nextcloud to Freeipa ldap and importing users with bash script from csv.




declare -i index=0
declare -a group_list

while IFS=’,’ read -r -a LINE; do
if [ $index -gt 0 ]
echo “adding user: ${LINE[2]}”
ipa user-add ${LINE[2]} --first="${LINE[0]}" --last="${LINE[1]}" --email="${LINE[3]}" --employeenumber="${LINE[6]}"
done < $FILE

while IFS=’,’ read -r -a LINE; do
if [ $index -gt 0 ]
echo “Setting password: ${LINE[2]}”
X=$(expect -c "spawn ipa user-mod ${LINE[2]} --password
expect "Password: "
send “${LINE[5]}\n”
expect “verify: "
send “${LINE[5]}\n”
expect “Modified””)
echo “$X”
done < $FILE

while IFS=’,’ read -r -a LINE; do
if [ $index -gt 0 ]
echo “adding: ${LINE[2]} to ${LINE[8]}”
ipa group-add-member ${LINE[8]} --users=${LINE[2]}
done < $FILE
exit 0