Skip to main content

How to export Jira project lead email addresses to csv (Jira Data Center)

Hello All!

Upgrading a large Jira Data Center instance is no easy task. One of the main steps of this process is communicating to project leads about this. When there are hundreds of Jira projects in your instance, it can be tedious to manually find the email address of each project lead. In this blog I will share how I exported all Jira project lead email addresses into a csv file using Jira REST API and Python.

This solution was tested on Jira Data Center version 8.x, Python3 and Windows 11. Let's see how we can get this email list in 3 easy steps.

Note: I assume that you have Python setup in your environment where you will run the script in Step 3 and you know how to run a python script. Also, that you have access to all Jira projects in the instance because REST API will only return data from projects where you have access. 

Step 1: Login to your Jira instance. Go to the url https://your.instance.domain/rest/api/2/project?expand=lead. This url will return all projects in your instance in JSON format. 

Step 2: Copy the entire JSON response returned on your screen and save this to a text file named "projects.txt".

Step 3 : Copy the below code and save this into a ".py" file (ex: export_leads.py). Then place the file created in Step 2 (projects.txt) in the same folder as the ".py" file. Finally run the python script.

import csv, json

input_file = open('projects.txt')
json_object = json.load(input_file)
json_array = json_object
email_list = []
list_of_leads = []

for item in json_array:
    project_details = {"Lead":None,"Name":None}
    project_lead = item['lead']['name']
    list_of_leads.append(project_lead) 
    project_details['Lead'] = project_lead    
    email_list.append(project_details)


# Get unique number of leads 
lead_set = set(list_of_leads)
print("Total leads count: "+str(len(list_of_leads)))
print("Unique leads count: "+str(len(lead_set)))


# Data to be written row-wise in csv file
dict_data = email_list

csv_columns = ['Lead', 'Name']
csv_file = "leads_email_list.csv"
try:
    with open(csv_file, 'w') as csvfile:
        writer = csv.DictWriter(csvfile, fieldnames=csv_columns)
        writer.writeheader()
        for data in dict_data:
            writer.writerow(data)
except IOError:
    print("I/O error")

This script will generate a CSV file with email addresses of all project leads which then you can copy and paste into your email to start communicating with them.

Thanks for taking your time to read this post. Hope this will help you !



Comments

Popular posts from this blog

How to export a list of Jira custom fields to csv (Jira Data Center)

 Hello All ! As a Jira administrator it is very important to keep an eye on the number of custom fields you have in your instance because the number of custom fields directly impact your instance performance. Atlassian also has confirmed this in their documentation .  One of the important strategies to keep your custom field number low is to reuse them as much as possible across projects. When you get a request from a user to create a custom project, you can provide a list of custom fields upfront, and ask the user to choose existing fields instead of creating new ones. Out of the box, Jira doesn't provide an easy way to export the custom field list to a csv file to share with non Jira admin users. In this blog I will share how I exported all Jira custom fields into a csv file using Jira REST API and Python. This solution was tested on Jira Data Center version 8.x, Python3 and Windows 11. Let's see how we can get the custom field list in 3 easy steps. Note : I assume that you...

How to send a survey with multiple questions in Jira Service Management (Jira Cloud & Jira Data Center)

Hello All, Out of the box Jira Service Management only allows to add one question for the customer satisfaction (CSAT) survey once a ticket is resolved. But most teams like to collect feedback on different aspects of the support provided to the customer by adding more than one question. In this blog I will go over a workaround to send multiple questions to the customer when a ticket is resolved.  Scenario Support team uses Jira Service Management to work on customer requests. Once a request is resolved an email needs to be sent to the customer with a survey including multiple questions. Survey response needs to be tied to the Jira ticket number. Solution In order to send multiple questions we will use a google form.  When the ticket is resolved the reporter will get an email with a link to a google form containing the survey questions.  The first field of the google form will contain (this will be autofilled) the issue key where the user received the survey. Given that we...

How to resume Jira SLA count down based on a date field (Jira Cloud & Jira Data Center)

Hello All, Many teams use Jira Service Management to provide support to internal and external customers. Certain types of requests require agents to reach out to other internal teams to complete the work required. Agents will come across that these internal teams have their own SLAs. The team intaking the initial request can decide to pause the SLA count down for the initial request when they are waiting for another internal team. In this blog I will go over how we can configure workflow / automation to resume the SLA count down based on a date field on the ticket, which will act as a reminder for agents to follow up with other internal teams. Scenario Support team uses the below Jira workflow When agents decide that they need to reach out to another team, they change the status of the ticket to "Internal Wait". SLA for the ticket needs to be paused when the ticket is in "Internal Wait" status (Some will argue that the SLA should not be paused. But that's a whol...