How to allow users to import Jira issues from Excel or CSV

Description

Jira only allows administrators access to the facility to import Jira issues. This describes how to create a Confluence page that allows normal users to import Jira issues. This is an example of using a run dialog to run CLI commands. In this case, the CLI commands are for an associated Jira instance.

Requirements

  1. Run Self-Service Reports for Confluence.
  2. Run CLI Actions in Confluence.
  3. Understand How to import Jira issues using CSV and setup your standard format for the Jira import excel or CSV file with corresponding import property file that defines column mappings.

Steps

  1. Create a dialog page similar to the example. It should be restricted to view only for normal users.
  2. Create auxiliary pages for the log and administration. 
    1. The log page helps for problem determination. Example: Jira import - log.
    2. The administration page should be restricted to view only for normal users to prevent changes to the import property file. Example: Jira import - admin.
  3. Add the import property file as an attachment to the admin page. See the import.properties example. 
  4. Construct the parameters for the run macro to match your requirements.
  5. Configure the Run CLI Actions in Confluence with a profile for your Jira instance(s).
  6. Test.

Screen shot

Example Wiki Markup

In the editor, go to the Insert ( + ) menu and select Markup to insert the example wiki markup.

{section} {column}
{info:title=Instructions}
# If using Excel, save JIRA import file as file type: *Comma separated value* 
# Drag and drop (or otherwise attach) the csv file to this page with a unique name (for example: <your user id>.csv)
# Press *Import into JIRA* button with *Yes* for *Simulate the run*
# Review to verify CSV is valid
# Select *No* on *Simulate the run*
# Press *Import and save output* button
# Review output to verify import worked as expected. If not, report the problem to an administrator.

h4. Related pages
{children:depth=2|excerpts=true}
{info}
{column} {column}{warning:title=Do not run more than once}

Only run this once for the production JIRA instance for a given csv file to prevent duplicate entries!
{warning}

{column} {section}

{attachments:patterns=.*|upload=true}
{run:autoRun=false|titleRun=Import into JIRA|titleExport=Import and save output|anchor=results|dateFormat=yyyy-MM-dd hh.mm.ss|exportFile=?JIRA import - log^$current_time.html|attachmentComment=?$attachmentName $simulate|
replace=attachmentName:$current_user_id.csv:Attachment name:text-required,simulate:--simulate:Simulate the run:radio::--simulate:Yes::No,showCommand::Show command and data:radio-more::showCommand=true:Yes::No,verbose::Show debug information:radio-more::-v --debug:Yes::No}

{anchor:results}
{cli:profile=jira|$showCommand|data=^$attachmentName|data2=JIRA import - admin^import.properties}
--action runFromCsv --continue --common "-a createIssue --project QA --type TestVariation" --file - --propertyFile @data2@ $simulate $verbose 
{cli}
{run}

Tips

When using Macro Security

If, for Macro Security reasons, you have restricted edit capability for this page for some users, you will need to setup a separate page that they can attach their CSV to prior to running the import. Adjust the help text accordingly, change the attachments macro to an include macro to reference the attachments page, and adjust the CLI action to reference the attachment from the attachment page.

Notifications

If you do not want notifications going out for the imported issues, use a profile (example here is: jiraNoNotify) that restricts notifications. See
How to limit notifications for automation actions.

If you have a test instance

Add another parameter to use the test instance first to verify the CSV produces the desired results. Then change the cli macro to use the profile parameter: profile=$profile instead of profile=jira.

profile:jira2NoNotify:Use production instance:radio::jiraNoNotify:Yes:jira2NoNotify:No,

Example files

  File Modified

File import.properties

Jul 03, 2019 by Former user

File admin.csv

Jul 03, 2019 by Former user