How to export users to CSV from a JIRA application
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.
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
copy cwd_user(id, user_name, lower_first_name, lower_last_name) to '/tmp/jirausers.csv' delimiters',' CSV HEADER;
this will include the headers.
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:
copy cwd_user(user_name, first_name, last_name, email_address, credential) to '/tmp/jirausers.csv' delimiters',' CSV HEADER;
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.