Views: 3112 (Data available since 06.02.2017)
Last Modified: 15.06.2015
Important! If the system uses the UTF-8 encoding, a CSV file must be created in this encoding as well.
Preparing a CSV File
A valid CSV file must exist before you import users from it. The file must have the following format:
Each line in the file represents a table row. A header can include any records in a single line. The header describes the data that follows it. The values in each line (the header and the data) are separated by a delimiter.
Example of user data header
The data in fields must match the format prescribed by the header. The field must exist no matter whether it is empty or not; essentially it means that, if there is no data for a field, the separator must exist (e.g. “;;”).
For example: if the file header has the following format:
and there is no data for some fields, say 2, 4 and 5, the data row must still be like the following:
Consider the following aspects when formatting a CSV file:
- Any delimiter character is allowed: comma (,), semicolon (;), space or tab. No spaces can exist between the values. If a delimiter is a space, make sure no double spaces have been added between the values.
- If a comma is the part of a value (for example, if the object properties are comma-separated), enclose the value in quotes ("yellow,red,green").
- If double quotes are the part of a value, enclose the value in double quotes. For example: "John" in a CSV file must look as ""John"".
- Empty rows in a CSV file are not allowed.
- The headers, string values, and logins are case insensitive.
- Passwords are case sensitive.
- Boolean values can be presented as: Y - true; N - false.
- Any excessive data existing after the last identified field are ignored. For example, if a file header specifies 10 values while the row contains 12 values, the last two values will be ignored.
- Empty data fields are processed as empty strings.
- The time and date format must be set in the format of the site language. For example: MM/DD/YYYY HH:MI:SS for English.
Exporting Users from Bitrix Framework
To export users, do the following.
- Open Settings > Manage users > User list.
- Click Excel to download data.
- After downloading, edit the file to conform the CSV format requirements:
- delete the export summary information at the end of the file;
- if required, change the field names in the file header with the correct ones (see the Data types table below);
- check if the fields are filled correctly (see the Data types table below).
The table contains all the data types that may encounter in a CSV file.
||Required ||Comments |
||No. Default is True. ||Active. |
|LOGIN ||string ||No. Auto generated by default. ||Specifies a user login, min. 3 characters. |
|PASSWORD ||string ||No. Auto generated by default. ||Specifies a user password, min. 6 characters. |
|NAME||string ||Yes ||User’s first name. |
|LAST_NAME ||string ||Yes ||User’s last name. |
|SECOND_NAME ||string ||No ||User’s second name. |
|EMAIL ||string ||No. Default value is the administrator’s e-mail. ||The E-mail address. |
|DATE_REGISTER ||date||No. Default is the current date. ||The date a user was registered. |
|LID ||string ||No ||The ID of a default site for notifications. |
|ADMIN_NOTES ||string ||No ||Administrator’s notes. |
|EXTERNAL_AUTH_ID||string ||No ||The external authorization source ID. |
|XML_ID ||string ||No ||The user ID for external connection (e.g. ID in an external database). |
|Personal data ||Type ||Required ||Comments |
|PERSONAL_GENDER ||string ||No ||Gender: M – male; F – female. |
|PERSONAL_BIRTHDAY ||date ||No ||Date of birth. |
|PERSONAL_CITY ||string ||No||Address: city. |
|PERSONAL_STATE ||string ||No||Address: region, state etc. |
|PERSONAL_ZIP ||string ||No||Address: ZIP code. |
|PERSONAL_WWW ||string ||No||Personal web site URL. |
|PERSONAL_PROFESSION||string ||No||Profession. |
|PERSONAL_NOTES ||string ||No||Arbitrary notes. |
|PERSONAL_ICQ ||string ||No||ICQ account number. |
|PERSONAL_PHONE ||string ||No||Home phone. |
|PERSONAL_PHOTO ||string ||No||The path to a photo relative to a folder specified in the import parameters. |
|PERSONAL_FAX ||string ||No||Fax number. |
|PERSONAL_MOBILE ||string ||No||Mobile phone number. |
|PERSONAL_PAGER ||string ||No||Pager. |
|PERSONAL_STREET ||string ||No||Address: street. |
|PERSONAL_MAILBOX ||string ||No||Address: P/O box. |
|Work data ||Type ||Required ||Comments |
|WORK_COMPANY ||string ||No||Company name. |
|WORK_DEPARTMENT ||string ||No||Department. |
|WORK_POSITION ||string ||No||Position. |
|WORK_WWW||string ||No||Company web site URL. |
|WORK_PHONE||string ||No||Work phone. |
|WORK_FAX||string ||No||Work fax number. |
|WORK_PAGER||string ||No||Pager. |
|WORK_STREET||string ||No||Company address: street. |
|WORK_MAILBOX||string ||No||Company address: P/O box. |
|WORK_CITY ||string ||No||Company address: city. |
|WORK_STATE ||string ||No||Company address: region, state etc. |
|WORK_ZIP ||string ||No||Company address: ZIP code. |
|WORK_PROFILE ||string ||No||Company profile. |
|WORK_LOGO ||string ||No||The path to a company logo image relative to a folder specified in the import parameters. |
|WORK_NOTES||string ||No||Arbitrary notes. |
|UF_*||string ||No||User field. |
|IBLOCK_SECTION_NAME_* ||string ||No||Information block binding. |
The UF_* values are user properties created by the administrator. The properties must be created before importing users.
The IBLOCK_SECTION_NAME_* values indicate the information block binding. 5 nesting levels are possible.
Important! The name (NAME) and the last name (LAST_NAME) are the only required fields to import users from a CSV file.
Example of a CSV file:
To make sure you will not encounter any errors during import, check that the file data meet the specification described at the beginning of this chapter. You can check this by opening a CSV file in MS Excel:
- Check the headers.
- Ensure the length of all passwords is at least 6 symbols.
- Ensure the length of all logins is at least 3 symbols.
Note! The system will always successfully import CSV files created in MS Excel. If you created a CSV file in some other application, open and check it in MS Excel.
After you have verified the CSV file, you can import it.
The Import Procedure
In the Import users form, select CSV file as a data source and click Next.
Fill in the fields in the next tab (Import Settings):
Click Next. The next step imports users. Upon completion, a message indicating the number of imported users will be shown.
Viewing Imported Data
To view the imported data, open Settings > Manage users > User list showing all the users registered in the system.
If the import procedure failed for some reason, delete all the records that have succeeded to import, correct the CSV file and perform the above actions again.