How to export users to CSV from a Jira application
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Sometimes it is useful to get a list of users exported to CSV for various purposes. Jira applications don't have this functionality but you can make use of either the Active User Filter Add-on or leverage various database functionalities to do this.
Run one of the following queries specific to your database. The output will consist of the id, username, first, and last name of the users.
Always back up your data before performing any modification to the database.
MySQL
1
select id, user_name, lower_first_name, lower_last_name into outfile '/tmp/jirausers.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' from cwd_user;
ℹ️ this will not include headers
PostgreSQL
1
copy cwd_user(id, user_name, lower_first_name, lower_last_name) to '/tmp/jirausers.csv' delimiters',' CSV HEADER;
ℹ️ this will include the headers.
Solution
Cloud's User Import
At times, customers are required to prepare the CSV file for user import as the users residing on external user management, and it needs to disable external user management to import successfully. To prepare the data for Cloud applications' user import, the format required is:
Users
1
copy cwd_user(user_name, first_name, last_name, email_address, credential) to '/tmp/jirausers.csv' delimiters',' CSV HEADER;
Membership
1
copy cwd_membership(child_name, parent_name) to '/tmp/jiramembership.csv' delimiters',' CSV HEADER;
ℹ️ Order is to be follow exactly as recommended on this documentation.
Was this helpful?