i want to export issues details automatically to google sheet based on JQL on a special time trigger for example export issues automatically on a daily basis
Hi @mahdi shirgholami I am not sure how to do it on google sheet. But in MS Excel you can do it via JQL REST API
Get Data in Excel from Web > enter JIRA jql get request. In Power Query editor select the fields which you want add as column.
thanks for your answer vikrant, you mean to do it with scriptrunner?
i tried this script but i get some errors and don't know how to deal with it
import groovy.json.JsonOutputimport groovy.json.JsonSlurperimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.search.SearchRequestimport com.atlassian.jira.issue.search.SearchRequestManagerimport com.atlassian.jira.security.JiraAuthenticationContextimport com.atlassian.jira.user.ApplicationUserimport com.onresolve.scriptrunner.runner.customisers.PluginModuleimport com.onresolve.scriptrunner.runner.customisers.WithPluginimport com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegateimport com.atlassian.jira.util.json.JSONObjectimport com.atlassian.jira.web.bean.PagerFilter
@WithPlugin("com.atlassian.jira.plugins.jira-importers-plugin")@PluginModuleCustomEndpointDelegate customEndpointDelegate
def jiraAuthenticationContext = ComponentAccessor.getComponent(JiraAuthenticationContext)def searchRequestManager = ComponentAccessor.getComponent(SearchRequestManager)
def currentUser = jiraAuthenticationContext.loggedInUserdef savedFilterId = 12345 // Replace with the ID of your saved filterdef cronExpression = "0 0 * * * ?" // Schedule for daily export at midnight
// Function to create a scheduled exportdef createScheduledExport() {def savedFilter = searchRequestManager.getSavedFilter(currentUser, savedFilterId as Long)
if (savedFilter) {def endpointUrl = "/rest/api/2/filter/${savedFilter.id}/export"def requestBody = new JSONObject(["cronExpression": cronExpression,"enabled": true])
def response = customEndpointDelegate.post(endpointUrl, JsonOutput.toJson(requestBody))
if (response.status == 200) {return "Scheduled export created successfully."} else {return "Failed to create scheduled export."}} else {return "Saved filter with ID $savedFilterId not found."}}
// Call the function to create the scheduled exportdef result = createScheduledExport()
return result
It looks like you're new here. Sign in or register to get started.