#1741: How to Import Users with the Employee Role from a CSV File
Отредактирована: сегодняThis article provides instructions for importing users with the Employee role from a .csv file.
The script is требовательный к формату CSV file: the columns 'Employee' (employee name) and 'E-Mail' (email address) must be present, separated by the ';' character.
Example content:
Employee;E-Mail
John Doe;john.doe@test.tld
Ivan Ivanov;ivan.ivanov@test.tld
Thomas Smith;thomas.smith@test.tld
...
Instructions
-
Connect to the Swarmica server via SSH as the root user.
-
Create a backup of Swarmica using this guide.
-
Upload the CSV file with the user list to the uploads folder in the django container:
docker cp <PATH-TO-CSV-FILE> swarmica-django-1:/swarmica/swarmica/uploads
where
-
Log in to the Swarmica web interface as an Administrator.
-
Create an import script in Swarmica - Settings - Scripts for the Administrator role:

- Upload the import_users.py script, add the following Web form parameters and click Save:
[
{
"name": "filename",
"type": "string",
"required": true,
"displayName": "CSV file name"
}
]
It should look like this:
- In the web form, enter the name of the CSV file loaded in step 2 and click Submit:

Troubleshooting
You can track the process in the log of the celeryworker container:
docker logs swarmica-celeryworker-1 -f
Or after the script runs:
docker logs swarmica-celeryworker-1 2>&1 | grep 'User import'