I'm trying to automate data from Jira into google sheets for all teams, whether they have data or not. For example, we have about 25 teams and I want to pull the data for all open customer escapes using Jira Cloud for Google sheets and set up a schedule. And then I want to be able to import that data to a heatmap that we use weekly.
The problem that I'm running into is that it only returns the teams that have a value and I want to show the 0 counts for the teams that don't return any. I don't think that I can return that list with a JQL which would be the easiest route.
I'm guessing that I can do conditional formatting to enter 0 if none match, and the value for the team if one was returned but I'm stuck on how to do that.
Any suggestions out there!
Jennie
To automate the process of pulling data from Jira into Google Sheets and displaying zero counts for teams without data, you can follow these steps:
function processJiraData() {
const sheetName = "JiraData"; // Name of the sheet with Jira data
const teamsSheetName = "Teams"; // Name of the sheet with the complete list of teams
const outputSheetName = "ProcessedData"; // Name of the output sheet
const ss = SpreadsheetApp.getActiveSpreadsheet();
const jiraSheet = ss.getSheetByName(sheetName);
const teamsSheet = ss.getSheetByName(teamsSheetName);
const outputSheet = ss.getSheetByName(outputSheetName);
// Get the list of teams
const teamsData = teamsSheet.getRange("A2:A").getValues().flat().filter(String);
// Get the Jira data
const jiraData = jiraSheet.getDataRange().getValues();
const header = jiraData.shift();
// Find the index of the team column
const teamColumnIndex = header.indexOf("Team");
// Create a map to count issues per team
const teamCounts = {};
for (let team of teamsData) {
teamCounts[team] = 0; // Initialize all teams with zero
}
// Count issues per team
jiraData.forEach(row => {
const team = row[teamColumnIndex];
if (teamCounts.hasOwnProperty(team)) {
teamCounts[team]++;
}
});
// Prepare data for output
const outputData = [["Team", "Open Issues"]];
for (let team in teamCounts) {
outputData.push([team, teamCounts[team]]);
}
// Clear the output sheet and write the new data
outputSheet.clear();
outputSheet.getRange(1, 1, outputData.length, outputData[0].length).setValues(outputData);
}
function setupTrigger() {
// Set up a daily trigger to update the data
ScriptApp.newTrigger('processJiraData')
.timeBased()
.everyDays(1)
.atHour(1)
.create();
}
Step 3: Create the Heatmap
By following these steps, maybe changing some things, you should be able to automate the data import from Jira, include teams with zero counts, and visualize the data using a heatmap in Google Sheets.
Thank you, Mikel!
This was the key part here:
Once that was in place, I was able to use the =countif function and then set it up for each team.
Thank you so much for your reply!
Jennie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jennie Neusch If you're looking for an on-going solution that doesn't require script maintenance or updating, Unito has a no-code integration for Google Sheets and Jira that can be set up in 15 minutes to keep issues and rows in sync bi-directionally.
Each flow can populate a new sheet with issues from specific projects and check for manual changes in real-time to keep your sheet and Jira project up-to-date automatically.
If you have 25 teams, you could create one flow, then duplicate it 25 times for each unique project.
The nice thing about a solution like that, is you don't have to re-create the same code or configurations each time you want something to change since Unito is set up through a visual flow builder.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.