Skip to main content
Skip table of contents

Export to Excel Using ScriptRunner

This script can be used in ScriptRunner to run export. Use ScriptRunner Jobs to add scheduling.

Export to excel

import com.atlassian.jira.component.ComponentAccessor
String fileName = 'filename.xls'
String userName = 'admin'
Long structureId = 1L
Long viewId = 2L
String viewSpec = null
String expandState = null
String clientFilter = null
def plugin = ComponentAccessor.pluginAccessor.getPlugin('com.almworks.jira.structure')
def helper = plugin.getModuleDescriptor('helper').module
def ExcelExporter = plugin.classLoader.loadClass('com.almworks.jira.structure.export.excel.ExcelExporter')
def exporter = helper.instantiate(ExcelExporter)
def ForestSpec = plugin.classLoader.loadClass('com.almworks.jira.structure.api.forest.ForestSpec')
def spec = ForestSpec.structure(structureId, helper.userManager.getUser(userName))
exporter.configure(viewId, viewSpec, spec, expandState, clientFilter)
def stream = new FileOutputStream(fileName)
try {
} finally {
    return new File(fileName).toPath().toAbsolutePath()

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.