#1753: Importing organizations and clients from CSV
Отредактирована: сегодняThis article describes the instructions for importing organizations and clients from a CSV file.
CSV file requirements:
- the file must have 3 columns:
client, email, organization - data must be separated by the ";" character
Example of CSV file contents:
client;email;organization
"James Rodriguez";"james_rodriguez_1658@example.tld";"Umbrella Co"
"Thomas Martinez";"thomas_martinez_4320@test.tld";"Hooli"
"Jennifer Lopez";"jennifer_lopez_8285@example.tld";"Massive Dynamic"
...
Instructions
-
Connect to the Swarmica server via SSH as the root user.
-
Create a backup of Swarmica using these instructions.
-
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 Administrator
-
Create an import script in Swarmica - Settings - Scripts for the Administrator role:

- Upload the script import_organizations_and_clients.py, 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 field, enter the name of the CSV file uploaded in step 2, and click Send:

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