Posts

Showing posts from March, 2022

JIRA Data Extract into Google Sheets through an API

function callJIRAPI() { // first, clear the sheet contents           var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet() var range = sheet.getRange("A1:G100"); range.clearContent(); // create the auth token for the API request to JIRA var pair = "firstname.lastname@mydomain.com:<My API Key from JIRA>" var base64 = Utilities.base64Encode(pair) var authHeader = "Basic " + base64 var url = "https://mydomain.atlassian.net/rest/api/3/search?jql=<JQL Query here>" // execute the query and parse the result as JSON var response = UrlFetchApp.fetch(url, { headers: { Authorization: authHeader, ContentType: 'application/json' } }); var dataSet = JSON.parse(response.getContentText()); // Create an array to store the results and push the column headers. These should match to the columns extracted below var rows = [] rows.push(["JiraID","CreatedBy","AssignedTo","Du