Don’t get me wrong, I think YouTrack is a great tool. But when it came to importing data from my old bug tracking tool to YouTrack, I was banging my head against the wall. Their current instructions are lacking examples and the whole process seems to have holes. So for anyone looking for CLEAR instructions with examples on how to import data from a CSV file into YouTrack, here it is:
1.) Download the latest version of YouTrack’s Python Client Library and unzip it.
2.) Make sure you have Python installed on your computer
3.) Copy this blank CSV file to <unzipped library directory>\python\csvClient
4.) Add all of your data to the blank CSV file mentioned in step 3.
- If you need to add new columns, make sure that the name matches exactly what’s in YouTrack. E.g. “Estimation” in the CSV matches with “Estimation” in YouTrack
- The “Issue Id” column should just be auto incrementing numbers
- The date fields must match the format specified in the “youtrackMapping.py” file mentioned below. Feel free to update your file if needed
5.) Overwrite the “youtrackMapping.py” file in the <unzipped library directory>\python\csvClient directory with this one.
6.) Execute the following command from the <unzipped library directory>\python\ directory
python csv2youtrack.py csv_file youtrack_url youtrack_login youtrack_password
Here’s what mine looks like
python csv2youtrack.py csvClient/import.csv http://test.myjetbrains.com/youtrack youtrack_login youtrack_password
7.) The script will probably take forever to run, but give it time. If it error’s out, I’ve listed some common errors and solutions below.
Traceback (most recent call last): File "csv2youtrack.py", line 140, in main() File "csv2youtrack.py", line 20, in main csv2youtrack(source_file, target_url, target_login, target_password) File "csv2youtrack.py", line 31, in csv2youtrack source = Client(source_file) File "/Users/tcasparro/Downloads/youtrack-rest-python-library-master 2/python/csvClient/client.py", line 8, in __init__ self._header = self._read_header() File "/Users/tcasparro/Downloads/youtrack-rest-python-library-master 2/python/csvClient/client.py", line 11, in _read_header header = self._get_reader().next() _csv.Error: new-line character seen in unquoted field - do you need to open the file in universal-newline mode?
This occurs when the newline characters in the csv are ill formatted, usually due to Mac OS. Resave the CSV using Unix or Windows line endings.