CSV Import and Export
LogMyTraining supports both import (via the app's built-in server or export from another app such as Mail app), as well as export of CSV files via e-mail. CSV (Comma-separated values) files are simple text files with a line for each set of values. See http://en.wikipedia.org/wiki/Comma-separated_values for more information. Most all spreadsheet programs, such as MS Excel, OpenOffice, Apple Numbers and Google Docs are all capable of reading and writing a CSV file.
LogMyTraining CSV Format
LogMyTraining has 4 different types of lines in the CSV file; the header line, summary line(s), trackpoint lines, lap lines. Let's go through each type of line; what it contains and how it is recogized by the app.
Header line
There is only one header line per CSV file and it must be the first line. It contains the names of all the fields so we know how to identify the values found in the following lines. Appendices A, B and C contain a complete list of the fields we currently use. Any other fields will be ignored.
Determining Lines
The line immediately following the header must be a summary line. Following the first summary line you might have either a series of trackpoint lines, lap lines or another summary line. In order to determine which type of line is following we use the following rules:
- If there is a value for the "lap" column which is non-empty, then the line is considered a lap line.
- If there is a value for either "category", "name", "location", "averagespeed (km/h)", "averagespeed (mph)", "maxspeed (km/h)" or "maxspeed (mph)", then we consider the line a summary line.
- Any other line is considered a trackpoint.
It is important to note that trackpoint lines must be preceeded by summary lines and lap lines must be preceeded either by a summary line or trackpoint lines.
Summary line(s)
The second line in the file must be a summary line. All activities must first have a summary line. The most essential field of the summary line is the datetime. The field must be present and it must be of the following format: yyyy-mm-ddThh:mi:ss
where yyyy is the four-digit year, mm is the two-digit month from 01 to 12, dd is the 2 digit day from 01-31, hh is the two digit hour from 00 to 23, mi is the two-digit minutes from 00 to 59 and ss is the two-digit seconds from 00 to 59.
Note: The summary line will only be loaded if datetime is specified in the format as indicated above.
The summary line can contain any optional information such as duration, distance, etc. Appendix A has a complete list of fields you can use in summary lines.
Trackpoint lines
Trackpoint lines represent the micro-intervals your device uses to record your activity. Often they are in only a few second intervals where heartrate, distance travelled, GPS location, power, cadence and other data is collected. Normally trackpoints contain the time in seconds from the start of the activity, distance travelled from the start and heartrate. (Currently longitude and latitude data are not saved). See Appendix B for a complete list of fields used for Trackpoints.
Lap lines
Lap lines are distinguished by having the "lap" field set which represents the lap number (although we don't actually use the lap number). They must follow either a series of trackpoint lines or a summary line which describes the activity. Laps represent a split which may have been made manually by clicking a button on your device, or automatically by your device at pre-determined intervals (autolaps) or it could be a lap calculated by software at predetermined distances using trackpoint data (for example SportTracks can do this). This is indicated in the "laptype" field. We differentiate between laps which have been recorded manually and laps which have been created either by the device or software. Manually recorded laps should have the "laptype" field with the value "recorded", auto laps should have the value of "laptype" set to "custom". All other laps will be saved ONLY if we have less than 3 autolaps or recorded laps.
Laps are similar to trackpoints but instead of saving data such as momentary heartrate or cadence, it saves the average and max values over the interval. See Appendix C for a complete list of fields used for Laps.
Examples
The best way to describe our CSV format is to give you some examples. We've created two examples, one is a summary of some activities performed in November 2011, and we have one version using kilometers/meters and another using miles/feet. As they are summaries they do not have any graphs or laps as no detailed information is included. You can download either:
logmytraining_summary_km.csv
logmytraining_summary_mi.csv
We've also created a detailed CSV which includes all the trackpoints and laps for an activity, giving us graphs and a lap table. You can download these examples here:
logmytraining_summary_km.csv
logmytraining_summary_mi.csv
We have also saved the documents in Google Document and can be viewed/copied from the Google Docs link.
It's easy to create your own example by exporting activities via the "Share" or "Email" button in LogMyTraining as we use the same format in export as in import.
Appendix A - List of Summary Activity fields
Field name | type | Notes |
---|---|---|
averagecadence (rpm) | number | Average Cadence |
averageheartrate (bpm) | number | Average HR |
averagespeed (km/h) | number | Average Speed (kmh) (calculated if distance/time specified) |
averagespeed (mph) | number | Average Speed (mph). (calculated if distance/time specified) |
bmi | number | BMI |
bodyfat | number | Bodyfat % |
calories (kcal) | number | Calories |
category | text | Used to identifiy sport. |
climbed (ft) | number | Total Ascent (ft) |
climbed (m) | number | Total Ascent (m) |
datetime | yyyy-mm-ddThh:mm:ss | Must be in this format and is required. |
diary | text | Day notes. |
distance (km) | number | Total distance (km) |
distance (mi) | number | Total distance (mi) |
duration | hh:mm:ss | Duration hh:mm:ss or mm:ss |
equipment | text | Equipment |
hyperLink | text | Any hyperlink you want to associate with exercise |
hyperLinkInfo | text | Text displayed for hyperlink on detail page |
injured | empty/non-zero number | Non-zero indicates you were sick on that day. |
location | text | Location of activity |
maxcadence (rpm) | number | Max Cadence |
maxheartrate (bpm) | number | Max HR |
maxspeed (km/h) | number | Max Speed (kmh) |
maxspeed (mph) | number | Max Speed (mph) |
missedworkout | empty/non-zero number | Non-zero indicates you missed a workout that day. |
name | text | Exercise Name |
notes | text | Exercise notes |
resthr | number | Resting HR for the day |
sick | empty/non-zero number | Non-zero indicates you missed a workout that day. |
subcategory | text | Used to determine sport |
temperature (°C) | number | temperature |
temperature (°F) | number | temperature |
totaldescended (ft) | number | Total descent (ft) |
totaldescended (m) | number | Total descent (m) |
weather | text | Description of weather |
weight (kg) | number | Weight in kgs. |
weight (lb) | number | Weight in lbs. |
Appendix B - List of Trackpoint fields
Field name | type | Notes |
---|---|---|
distance (km) | number | Total distance (km) |
distance (mi) | number | Total distance (mi) |
duration | hh:mm:ss | Duration hh:mm:ss or mm:ss |
heartrate (bpm) | number | Heartrate |
elevation (ft) | number | Current elevation (ft) |
elevation (m) | number | Current elevation (m) |
cadence (rpm) | number | Current Cadence |
power (W) | number | Current Power |
Appendix C - List of Lap fields
Field name | type | Notes |
---|---|---|
laptype | text | "recorded" or "custom" |
distance (km) | number | Total distance (km) |
distance (mi) | number | Total distance (mi) |
duration | hh:mm:ss | Duration hh:mm:ss or mm:ss |
averageheartrate (bpm) | number | Average HR |
maxheartrate (bpm) | number | Max HR |
maxcadence (rpm) | number | Max Cadence |
averagecadence (rpm) | number | Average Cadence |
averagepower (W) | number | Average Power in watts |
maxpower (W) | number | Max Power in watts |