TrackStudio Enterprise 3.5
CSV Import Concepts

The following topic describes how to import data from a CSV file to TrackStudio.

Use CSV import to import tasks, messages and users to TrackStudio. Before importing data, prepare a file with data in the CSV format and a script of the CSV Import type.

Source CSV File Requirements

Prepare a file with data in the Microsoft Excel CSV format. The CSV file must contain a header line. To get an example of a correct CSV file, export tasks into the CVS format using a report of the the List type.

CSV Import Script Requirements

The script is executed for each line of CSV file. Each line is parsed and stored in the inputMap object of the Map class. Each field in the header line is a key while the value is the corresponding field from the line being processed in the CSV file. 

To create one TrackStudio object out of one line in a CSV file, the script must return an object of the Map class that describes the object being created. To specify the type of the object being created, place an item with the CSVImport.OBJECT_TYPE key and one of the following values into the collection:

Value 
Created Object 
CSVImport.TASK_TYPE 
Task 
CSVImport.MESSAGE_TYPE 
Message 
CSVImport.USER_TYPE 
User 

To create several TrackStudio objects, the script must return a collection of objects of the Map class. Objects will be imported in the order they are arranged in the collection.

Custom Field Data Import

To import the values of custom fields, specify an object of the Map class containing the {Custom field ID,Custom field value} pairs as the value of the TASK_UDF_MAP/USER_UDF_MAP/MESSAGE_UDF_MAP key. The custom field value must be specified as a line. To separate several values of custom fields of the Multi List, User and Task types, use ";" character.

Date Formatting

To convert a date from a String into an object of the Calendar class, use the parseToCalendar() method of the DateFormatter class. In case the date locale in the CSV file differs from the logged user's locale, specify the locale of the CSV file in the locale variable:

String locale = "fr_FR";
DateFormatter df = new DateFormatter(sc.getUser().getTimezone(), locale);
taskMap.put(CSVImport.TASK_SUBMIT_DATE, inputMap.get("Submit Date") != null ?
   df.parseToCalendar((String) inputMap.get("Submit Date")) : null);