CSV Importing of 'sub-tasks' and linking to existing 'Story'

Gil Groman February 21, 2015

I would like to import 'Story' and 'sub-task' from CSV to JIRA linking the sub-tasks to New or existing Stories (e.g. TEST-422)

The example I found in the documentation of a similar CSV is of:

Issue Id, Parent Id, Summary, Issue Type
 1, , Test, Story
 2, 1,ST For Test, Sub-Task
 3, 1,ST For Test, Sub-Task

 

But this cannot be used as I do not have the 'Issue ID' for the new or existing stories, only the 'Issue Key' or in some cases only the issue textual title (summary)

Would appreciate a simple example on how this could be done. 

13 answers

1 accepted

22 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2015

You do need the Issue ID for subtasks - this is the one single unique identifier for the parent issue, and without using that, there's no reliable standard way to add subtasks to a parent.  Summary isn't good enough, it's perfectly possible to create issues with duplicate summaries.

So, there are two possibilities to talk about here.

  1.  You already have issues in JIRA, and want to create subtasks.  You need to add a column to your CSV that contains the issue ID of the parent - i.e TEST-422 (if you have a mix of sub-tasks and non-subtasks, you leave it blank for non-subtasks)
  2. Your data contains a mix of parent and sub-tasks to create

The second sounds like what you are trying to do, and it's a bit of a faff, although I can't see any more simple way to do it really.

Create TWO columns in your CSV.  Call one of them something like "Sequence" and the other "My Parent".  The sequence is effectively going to be a temporary unique id for JIRA to look at when trying to create subsequent subtasks, and the parent field is the thing to tie them together.

Taking your example (and repeating it a bit for hopefully improved clarity)

Your data is:

  • Issue-a
  • Subtask-a1
  • Subtask-a2
  • Issue-b
  • Subtask-b1
  • Subtask-b2

You need to create CSV

  • Sequence, My Parent, Summary
  • 001, ,Issue-a
  • 002, 001,Subtask-a1
  • 003, 001,Subtask-a2
  • 004, ,Issue-b
  • 005, 004,Subtask-b1
  • 006, 004,Subtask-b2

What JIRA does here is look at, but not import, the "Issue ID" column.  The column is there to provide a simple unique identifier in the csv, not in JIRA.

The second column says "I am a subtask, and I belong to the line in the CSV with the Issue ID of xxx".  Again, JIRA will not import it, it is just for tying subtask to parent during the import.

Note - I've always done this using a simple sequential number for "Issue ID" - spreadsheets can do a simple click and drag trick or use a formula for "cell above + 1" to generate the sequence.  Obviously, these need to be unique, but I don't really know that they have to be sequential.  Also, I think order matters - I've always ensured that a parent issue is higher in the CSV that any of it's subtasks.

Gil Groman February 22, 2015

Thank you Nic!

Your answer clarified very well to me how to add new Stories and Sub-Tasks together in a CSV (2)

Is there a way to do option (1) -  add sub-tasks to existing JIRA Stories?

Is there a way to get the Issue-ID to be added to the CSV? (maybe by using the Issue-Key?)

I have no problem adding this manually to the CSV after looking it up, just need to know how.

 

Like # people like this
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 22, 2015

As I said for 1, use the existing issue ID

Like Vivek Singh likes this
Gil Groman February 22, 2015

I am not sure I know how to get the it: The Issue-Key is the visible name that changes per JIRA DB (e.g. TEST-422) The issue-ID should a non-changing key ; where is it made visible for existing JIRA items (stories)?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 22, 2015

Oh, sorry, I've used the phrases unclearly. The key (test-422) is the one you need to use in your csv. The issue-id (10255) is rarely exposed to the users directly and is not really made visible anywhere.

Like Meeran likes this
Duc Nguyen Hoang October 30, 2016

it's not working. I did exactly the same as you sampled.

Conor McCooey February 27, 2017

doesn't work. The sub-tasks get created as orphans when trying to import to existing stories

Like # people like this
Gwen Jettain June 2, 2017

Add sub-tasks to existing Story through .csv upload

Hi Everyone,

I seemed to have find a way to do it yesterday after many frustrating attempts.

When you create your .csv file, include a column with the Parent ID (The story you are trying to link your subtasks to) but also an Epic Link column (Here you will have the name of the Epic, the Story is linked to).

Please let me know if it works for you!

 

Like # people like this
Trang Tran June 22, 2017

Guys,

I've just figured out that the value of Parent ID needs to be taken from External Issue ID of existing issue.

In other words, the Issue ID mentioned in documentation when importing issue and subtasks from CSV file is External Issue ID, not the id you will see in the issue 's url (it is internal ID)

Cheers!

 

 

Like Anzar Khan likes this
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 23, 2017

Yes, that was in the original answer:

What JIRA does here is look at, but not import, the "Issue ID" column.  The column is there to provide a simple unique identifier in the csv, not in JIRA.

The second column says "I am a subtask, and I belong to the line in the CSV with the Issue ID of xxx".  Again, JIRA will not import it, it is just for tying subtask to parent during the import.

Trang Tran June 26, 2017

oh yes, for new issue with linking subtasks, it is as you have described. However, for existing issue, in case I need to import subtasks to that issue, I will need to use external issue ID

Like PM likes this
M Shaikh November 1, 2017

Hi Nic,

I have a common set of stories and tasks which are applicable for all projects. I need to add those stories and tasks in a project through .CSV file. Can you share with me the .csv format. I need to add tasks in Kanban board.

Thanx.

James Wan November 3, 2017

I tried Nic's solution for Scenario 2 but failed. I tried both "Epic & Story" and "Story & Sub-task" combination and neither succeeded. 

- In the "Mapping Fields" step, if I don't map "sequence" field and "My Parent' field, Jira just ignore them. (I am wondering how Jira can parse such two user-defined columns and link them smartly? The column names are not any of the Jira keywords. How does Jira know it needs to link them together?)

- If I mapping the 2 new fields to some existing fields such as "Issue ID" and "Parent ID", then I get an error message that the ID is invalid.

Am I doing something wrong?

Like # people like this
Aditya Sharma May 27, 2020

@Nic Brough -Adaptavist-

Since you have mentioned about the creation of issues and the corresponding sub-task for the first time using the sequencing methodology. What type of sequence to follow in the excel sheet for updating the already created stories and sub-tasks? 

If I keep Parent id as 1 and Issue id as 2, it creates a new issue instead of updating the existing one. What should be done?

Ellen Albright April 4, 2023

Issue key" : {
"jira.field" : "subtask-parent-id"
},

32 votes
Jason Odra November 1, 2018

Here is how I was able to import Stories with Subtasks successfully. 

For testing purposes, I kept the columns simple:

Parent id, Issue id, Issue Type, Summary

Screen Shot 2018-11-01 at 3.28.11 PM.png

Jira only uses the Parent id and Issue id for mapping purposes so you can use whatever number scheme you want. For a Story, you leave Parent id blank. For a Sub-task, you use the Issue id of the Story. I still used an Issue id for the Sub-task. 

I then mapped:

Parent id > Parent id

Issue id > Issue id

Issue Type > Issue Type

Summary > Summary

Screen Shot 2018-11-01 at 3.33.33 PM.png

On the next screen, I verified the values from the mapping and clicked Begin Import.

Screen Shot 2018-11-01 at 3.35.02 PM.png

And walla!

Screen Shot 2018-11-01 at 3.36.30 PM.png 

I was able to import Subtasks using a similar process to the above.

Screen Shot 2018-11-01 at 3.52.42 PM.png

The exception is for Parent id I used the Key to the Story.

The result:

Screen Shot 2018-11-01 at 3.54.58 PM.png

Philip Cushing November 19, 2018

Excellent and clear breakdown. Followed this and had no issues whatsoever. One of our teams needed some help with repetitious task creation in the Cloud JIRA and as the admin I said I would help. This makes it so much easier.  Mahalo nui loa

Like # people like this
Marek Dziedzic November 29, 2018

Hi Jason,

Thanks for the detailed breakdown. Quick question for you, are you using JIRA Server or Cloud?

We're on the Cloud instance, and I don't have the option for an "Issue Type" during the import. Do I need to configure something in the JIRA Settings?

My import screen also looks different... it doesn't include any of the comments about sub-tasks at the bottom.

Screen Shot 2018-11-29 at 1.03.03 PM.png

Marek Dziedzic November 29, 2018

After spending a day trying to figure this out, here is the solution.

First, confirm that this functionality exists on your instance:

  1. go to JIRA Settings > System > External System Import.
  2. Attempt to upload a file and confirm if you have access to Issue Type.

If you do, this means that your JIRA instance supports the ability to map issue type for a CSV import, but that your edit screen is not configured. If you do not see this setting, unfortunately I do not have a solution.

 

In the case that you did see the Issue Type in the External System Import tool, you can modify your edit screens to allow all users to add Issue Type during an import. To do this:

  1. Navigate to Project Settings > Screens.
  2. Click on Action in the top right corner and select Edit Screens
  3. Next to Default, click on the Screen Scheme link
  4. Next to Default (again), click on the Screen link
  5. Under the Field Tab, scroll to the bottom of the screen and add Issue Type from the Select Field... drop down.

You should now be able to select issue Type from the standard issue importer when adding tickets as a normal user.

Conrado Morlan January 11, 2019

Thank you Jason Odra, the screenshots helped a lot!!!

Paige December 15, 2020

@Jason Odra Thanks a million, this worked for my needs!! 

I was attempting to import new sub-tasks to existing stories.  All I had to do was put the story's issue key (ABCD-123) into the 'Parent ID' field of the sub-task.  

Taduri_ Kiran December 22, 2020

@Jason Odra  - Can you please clarify this question.  'Parent Id' or 'Issue Id' is a unique identifier of an issue (Story/Sub-task) that Jira automatically generate while creating an issue.  In your example(pasted below), you have used the value of '10000' for 'Issue Id' of the Story.  What if the database already has an issue with the same value, Jira would not accept this value.

 

Screen Shot 2018-11-01 at 3.28.11 PM.png

Ashley Spurlin March 31, 2022

Thank you so much for the detailed instruction! Quick question, though: is there any reason, when importing sub-tasks only, to actually map the Issue ID? In my test, if I choose not to map the Issue ID, the imported sub-tasks will be automatically assigned an external ID. If the external ID is automatically assigned, it seems less likely to create a collision with subsequent imports to the same project.

4 votes
Steven Marusic September 14, 2017

For anyone else reading this thread, Nic Brough's original post above works perfectly (contrary to some other comments in the thread). 

If you are trying to both add sub-tasks to existing stories and create new stories with new subtasks in the same import, I would suggest breaking your data up into 2 separate CSV files (one for each scenario) and doing 2 separate imports. That will simplify things quite a bit.  Follow Nic's instuctions above exactly as described for the 2 different scenarios and it will work perfectly.

To add subtasks to existing stories, this is all you need to do (Paraphrasing from above):

  1. Add a column to your sub-task CSV file that contains the Issue Key of the parent (e.g. TEST-422)
  2. Leave the Issue ID column blank.
  3. Map the 'Parent ID' column you created to 'Issue Key' in the import template.
  4. Do your import

Thanks Nic!!!! You saved me a TON of time!

M Shaikh November 2, 2017

Hii Steven,

I'm getting the below error while importing the second sheet which consists of all the tasks with Parent-ID. Can you help me out please.

"You have to define which CSV column maps to Issue Id if you want to import sub-tasks."

 

Thanx for your support.

Steven Marusic November 3, 2017

Hi M Shaikh,

I'm not sure I totally understand what you are doing with your second import, but if you want to import stories with subtasks, and do it in two steps as I suggested you will have to do the following,

1. Create a CSV file with all of the stories you want to create (No subtasks).

2. Import those stories into Jira. (At that point you can get the Issue ID's from your parent stories that are necessary for mapping your subtasks).

3. Create your CSV file with your subtasks identifying the parent story for each subtask by using the IDs you got above. 

Your subtask file columns should look like this

Issue ID | Parent ID | (The rest of your columns)
<Blank> | DEMO-1234 | (Additional column Data)
<Blank> | DEMO-1234 | (Additional column Data)

Each subtask associated with a given parent should have the same Parent ID.

4. Map Parent ID in your file to Issue ID on the import mapping screen.

5. Import your Subtask CSV file.

That should do it. Let me know if that answers your question, and works.

Like akshat62 likes this
Allison Carlson March 20, 2018

Hi Steven Marusic - 

there appears to be a contradiction above.

(a) In your paraphrasing above, you have " 3. Map the 'Parent ID' column you created to 'Parent ID' in the import template. "

(b) then later you have "4. Map Parent ID in your file to Issue ID on the import mapping screen"

I too am trying import sub-tasks and map to parent where all parent tasks are already in JIRA.

I tried both approaches

(a) mapping parent_id , which is the parent issue key (ex DEMO-1234) to the Parent ID in the import step.   for this, the sub-tasks were created, but are all orphans

(b) mapping parent_id (ex DEMO-1234) to the Issue ID in the import. for this . nothing was imported.

 

 

So I wanted to confirm - which field is the Parent key (from the import file) supposed to be mapped to in the import?  the Parent id or the Issue Id?

Allison Carlson March 20, 2018

actually, I deleted all and did it again, and THIS approach did work:

 - mapped parent_id in the xls, which is the parent issue key (ex DEMO-1234) to the Parent ID in the import step.
- first time thru,with  issue Id not mapped , get error: "You have to define which CSV column maps to Issue Id if you want to import sub-task"
- so I mapped the Issue Id in the file (just some sequential number)  to Issue Id in the import  

 

and it worked! no more orphans. 

 

but this statement must be a typo in the summary above: Map Parent ID in your file to Issue ID

Like Anjana Ananth likes this
Steven Marusic March 20, 2018

Hi Allison!

Trying to walk through this. I did this awhile ago, and haven't had to do it since, so I don't remember the details. But when I get a few minutes I'm going to walk through it again. If you got it to work the way you described, then that is likely a typo. 

Thanks for pointing it out. I don't want to lead anyone else astray :-).

Steve

Like Allison Carlson likes this
Steven Marusic March 20, 2018

Allison,

You are absolutely correct. Statement 3 in my first post should have been 'Parent ID' to 'Issue ID'! Sorry for your wasted time, but thanks for finding the error!

I edited the post above.

Thanks Again!

Steve

Like Allison Carlson likes this
Allison Carlson March 20, 2018

no wasted time.. I learned a lot by trying different ways.

thanks for the great summary!.

Steven Marusic March 20, 2018

Glad I could help!

Lisa Lolk Hauge January 31, 2020

Best explanation yet - so simple ! Thanks a lot, Steven !

Anjana Ananth May 7, 2020

Appreciating Steven for putting it simple and also Allison for bring out the typo. Kudos guys, you all saved a lot of time on trials :)

Thank you so much !

Allison Carlson May 8, 2020

Glad my comment helped!

Priti patel January 4, 2024

Hello,

I have task and Subtask in jira in one project. Now i want to link already created subtask with already created task. how can i do and which field i need to consider. i do not want to create new task and subtask.

2 votes
Gwen Jettain June 2, 2017

Add sub-tasks to existing Story through .csv upload

Hi Everyone,

I seemed to have find a way to do it yesterday after many frustrating attempts.

When you create your .csv file, include a column with the Parent ID (The story you are trying to link your subtasks to) but also an Epic Link column (Here you will have the name of the Epic, the Story is linked to).

Please let me know if it works for you!

1 vote
Debashish Chakravarty October 5, 2021

@Gil Groman 

Here is something which I created and worked for me in my JIRA project.

With this template, we can create multiple subtasks under a user story present in JIRA. Create a .csv file with the columns as mentioned in the attached image.

SubTask Creation in Bulk.PNG

Only point to note is map - Issue key to Parent Id while you map the fields from .csv to JIRA fields.

Do let me know, if this helps.

Thanks,

@Debashish Chakravarty 

0 votes
Vinod Kotiya February 23, 2023

All are giving wrong answers and Even JIRA documentation is wrong. The parent ID should not be numerical but the existing key. Here is example of how to add sub-task to existing task or story. All are giving wrong answer by importing new task and sub-task. 

Capture.PNG

0 votes
Brett Henderson March 2, 2022

While mentioned early on in this thread, it's important to realised that the Issue ID that you put in your CSV is stored as External Issue ID in Jira.

What this means is that

a) if you attempt to import a CSV file that uses the same "unique ids" used previously for new tickets, it will fail to import them as they "already exist"

b) if you import a CSV with subtasks with the Parent ID the same as an existing External Issue Id they will be applied to that existing ticket.

To illustrate, if I import a CSV with the following values

Screen Shot 2022-03-03 at 11.42.15 am.png

Tickets 1 & 2 will have External Issue ID's as 1 and 2 respectively and will have the sub tasks linked.

If I attempt to load a new CSV like this

Screen Shot 2022-03-03 at 11.44.33 am.png

Tickets 3 & 4 will not be created as the "ID" already exists. Additionally the two subtasks in this file will be allocated to the original Tickets 1 & 2 respectively that were previously imported.

This implies (and I'm yet to verify) that to make this work, all Issue IDs used in all CSVs imported into a project must be unique for all CSV's, not simply the one you are importing currently.

If this is the case, then making the Issue ID value in the CSV based on the current date/time is the only way I can see multiple imports working.

0 votes
Chris Hugenberger April 2, 2020

I believe you can also accomplish this using the Deep Clone add-on

Marlene Kegel - codefortynine
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 3, 2020

Thank you for mentioning Deep Clone for Jira@Chris Hugenberger !

It's possible to bulk clone Subtasks and link them to any existing parent issue with our app. 

deep-clone_subtask-test.png

Divya Reddy February 12, 2021

Hello Team,

Can any of you please help me with bulk import of new stories with  sub tasks . I have tried exactly the same how @Jason Odra mentioned in his example but does not work for me. i see errors. 

 

Thanks & Regards

Divya 

Divya Reddy February 12, 2021

@Nic Brough Please need your help - Allow to create Parent Issue and Subtask in single import . I have tried the way you mentioned in above example but unable to succeed.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 12, 2021

Have you tried doing what was explained in the accepted answer?

Divya Reddy February 14, 2021

Hello @Nic Brough -Adaptavist- 

Below is the format of my csv file. I have made an excel first before saving as CSV. Can you please help where i am going wrong.

bulk upload.png

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 17, 2021

How are you mapping the parent id and issue id columns?

0 votes
Aditya Sinha March 11, 2020

1) Create and Excel with Issue ID, Issue Type, Parent ID, Summary 
2) Issue ID is the 6 digit number, Issue type is 'Sub-task' , PArent id is 'Issue key', Summart is 'What you want as Sub task'. Save Excel as CSV

3) Click on Issues drop down, select upload through CSV

4) Upload CSV, map all fields as mentioned above

5) And done

0 votes
Maddie October 1, 2019

Hey, just wanted to let you know the solution of adding a new column with the parent link to the subtask, also worked for me!

Below, I've selected the column I've created in the CVS export, where I added the parent link.

image.png

0 votes
Sue Webber March 8, 2018

Hi there

I managed to get the import to work correctly, however the sub tasks are not showing on portfolio whilst they show linked correctly in the jira issue screen.

Sue Webber March 8, 2018

Hi I fixed this, do not use the Epic link as suggested in one of the comments above. Removing the pic link from the sub tasks (which shouldnt have an epic link) resolved the issue.

0 votes
Yang Yu October 17, 2017

Succeeded importing subtasks to existing issues. 

- you will need 2 separate columns 

a) issue id

- this is the sequential unique identifier (for the subtasks to be linked to existing issues) mentioned in previous post. 

b) parent id

- this is the 'issue key' for existing issues. I was confused by 'id' as I used the "issue id" (the unique number for an issue, start with 5 digit, you can get it by "Export Excel CSV (all fields)")

Arun Makhija November 12, 2017

I am receiving following validation error

  • Subtask '<name of sub-task>' doesn't have a valid Parent Id selection. Issue will not be created.

Even though I have selected a valid parent id from CSV export and its a 6 digit number. Any other pointers ?

 

arun

Arun Makhija November 12, 2017

Succeeded, 

mine worked with using the "Key" field (also used as Rank in ORDER BY function)

using the 5-6 digit Parent Id didn't work

Adriana Chavarria November 24, 2017

Thank you!!! I had same issue... 

Not sure why Jira maps Parent ID with Issue Key... but finally works :)

Like Ivan Sotelo likes this
Ling Jing Liu January 4, 2018

Thank you Adriana. This is really helpful! I used Issue Key as Parent ID to import subtasks. It works!

0 votes
Daniel Benoit August 29, 2017

Can you link stories and task together via CSV import? Issue type Story and task (not sub-task).

Suggest an answer

Log in or Sign up to answer