Skip to content

Instantly share code, notes, and snippets.

@hon2a
Created October 15, 2019 14:18
Show Gist options
  • Save hon2a/1f13892f0b3d6530bdabe013d1ed8be3 to your computer and use it in GitHub Desktop.
Save hon2a/1f13892f0b3d6530bdabe013d1ed8be3 to your computer and use it in GitHub Desktop.
Move JIRA issues between instances & projects
/**
* 1. Open the old JIRA instance and create a search showing the issues to export.
* Click on _Export > Export Excel CSV (all fields)_.
* 2. Open the new JIRA instance and create a sample issue in it with the fields filled in
* to provide default values for the issues to be imported. Filter for this issue
* in search and export it as above.
* 3. Open https://www.papaparse.com/demo and open the Console from Developer Tools.
* Execute the following code:
*/
const { data: oldIssues } = Papa.parse(OLD_JIRA_CSV_STRING, { header: true })
const { data: [sampleIssue] } = Papa.parse(NEW_JIRA_CSV_STRING, { header: true })
const newIssues = oldIssues.map(
issue => Object.entries(sampleIssue)
.reduce((acc, [key, defaultValue]) => ({
...acc,
[key]: (issue[key] === undefined) ? defaultValue : issue[key]
}), {})
)
Papa.unparse(newIssues)
// The output should be a CSV string to import into the new JIRA.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment