YouTrack Standalone 2017.2 Help

Import from a CSV File

The Python Client Library supports importing issues to YouTrack from a CSV file. Virtually, this option lets you import data from any issue tracker that can export issues as a CSV file.

To import issues from an existing CSV file:

  1. Download the latest version of YouTrack's Python Client Library and unzip it.

  2. Install Python.

  3. Create a mapping file to set the correspondence between source fields in a CSV file and YouTrack issue's attributes. This mapping file should be created in the <unzipped library directory>\python\csvClient directory. For more details about structure of the library, refer to the Python Client Library.

  4. When a mapping file is created, specify the mapping file in the csv2youtrack.py file:

    from csvClient.client import Client from youtrack.connection import Connection import sys #import csvClient.myYoutrackMapping import csvClient.<new_mapping_file_name> import csvClient import youtrack import time import datetime import calendar

  5. Import issues from a file to YouTrack running the following command:
    python csv2youtrack.py csv_file youtrack_url youtrack_login youtrack_password
    Enter values for the following command-line parameters:

    Parameter

    Description

    csv_file

    Path to the source CSV file.

    youtrack_url

    The URL of the target YouTrack server.

    youtrack_login

    YouTrack administrator user name.

    youtrack_password

    YouTrack administrator password to log in.

Import Comments

The current format for importing comments is as follows:

<field1>, <field_2> <field1 value>, <field2 value>, <this column doesn't have name, so this will be the first comment>, <this will be the second comment>, <and this will be the third>

That is, any string between commas (i.e. a column) that comes without a field name will be rendered as a comment.
If you want to use any other format, you should modify the script.

Sample CSV File

"Issue Id","Project","Type","Priority","State","Subsystem","Module","Reporter","Assignee","Reviewer","Created","Updated","Summary","Description","CustomFieldString","CustomFieldDate" SA-1,SomeApp,Task,Critical,In Progress,UI,Admin Console,Marco Fu,John Higgins,Neil Robertson,2011-03-01 16:55:00,2011-03-02 17:54:00,"Issue 1","Description for issue 1","Start",2011-03-02 18:00:00 SA-2,SomeApp,Bug,Major,Open,Core,,John Higgins,Marco Fu,Neil Robertson,2011-04-01 17:55:00,2011-04-02 18:54:00,"Issue 2","Description for issue 2",,2011-04-02 19:00:00,"Comment 2.1","Comment 2.2" SA-3,SomeApp,Bug,Normal,Fixed,Core,Main,Neil Robertson,Mark Allen,Neil Robertson,2011-04-02 17:55:00,2011-04-03 18:54:00,"Issue 3","Description for issue 3","PX-1",2011-04-03 19:00:00,"Comment 3.1","Comment 3.2" SA-4,SomeApp,Task,Normal,Fixed,UI,User Profile,Neil Robertson,Mark Allen,Mark Williams,2011-04-02 13:55:00,2011-04-03 14:54:00,"Issue 4","Description for issue 4","PX-2"

Sample Mapping File

import csvClient csvClient.FIELD_NAMES = { "Project" : "project_name", "Summary" : "summary", "Reporter" : "reporterName", "Created" : "created", "Updated" : "updated", "Description" : "description", "Issue Id" : "numberInProject", "Subsystem" : "Subsystem", "Module" : "Module", "Assignee" : "Assignee", "Reviewer" : "Reviewed by", "CustomFieldString" : "Iteration", # Map column "CustomFieldString" to "Iteration" filed. "CustomFieldDate" : "Planned Date" # We can skip mappings for default fields like Type, Priority, State. } csvClient.FIELD_TYPES = { "Subsystem" : "ownedField[1]", "Module" : "enum[1]", "Assignee" : "user[1]", "Reviewed by" : "user[1]", "Planned Date" : "date", "Iteration" : "string", # Define type for field "Iteration". } csvClient.CSV_DELIMITER = "," csvClient.GENERATE_ID_FOR_ISSUES = False csvClient.DATE_FORMAT_STRING = "%Y-%m-%d %H:%M:%S"

Last modified: 7 March 2019