CSV to FIT, file format of CSV.

I'm using, or trying to use, the CSV to FIT file converter. I've successfully converted a valid FIT file to CSV & back again to a valid FIT using the java based tools. However, I cannot alter the CSV file to add some missing data and convert back to FIT as it's unclear what the CSV format should be? Is there a guide somewhere on how to add fields to a CSV file so it will successfully convert to a FIT file please? Unsure what developer program to put below! (I'm an electronic hardware design engineer, albeit retired, so my software skills are a bit limited)!

  • You mentioned in an earlier post that you had some success using the Java SDK, so that is where I suggest starting. EncodeExample.java has a few simple examples. The settings file example would be a good one to look at, as it is the shortest. Modify the example code to create a FIT file with the messages and fields that you are interested in. From here you can keep using the SDK as your solution or convert the FIT file that you created to CSV and use that as a guide when editing other CSV files. One hint, the mesg definitions are not actually needed in the CSV file. All that is really needed are the data rows, and the local number can be set to zero for all messages.

    There is more info on compiling and running the example projects here.

    https://developer.garmin.com/fit/example-projects/java/

  • Hi Ben,

    So, I've managed to convert a CSV file using java SDK to a Garmin compatible FIT file.  I did a conversion of FIT to CSV to get the precise format, and now I have a TCL script that builds a CSV file to EXACTLY same format (from weight & other data) which so far converts to a FIT file nicely, which I can upload to Garmin Connect

     This CSV has nine fields, but I want to add a few more, but failing miserably.  I added just one field as a test but this would not work at all.  I would attach the good & bad csv files (zipped if preferred), but can't see how to?

    I added the following to row 1: Field 10, Value 10, Units 10 

    I left rows 2 & 3 untouched

    In rows 4, 5 & 6 I added BMI under "Field 10" but leave "Value 10" & "Units 10" empty/blank.

    If I now convert that CSV to a FIT, it works OK, but as soon as I put any values under "Value 10"  it fails to convert, (I put "1" in row 4, the same as the other "value" columns in row 4 are), and the actual BMI values in rows 5 & 6).

    Any help much appreciated.

  • The FIT CSV Tool uses the Java SDK to read/write FIT files, and you can not add fields to a message in a CSV file that are not defined for that message in the Java SDK. Look in WeightScaleMesg.java, or Profile.xlsx, and you will see the fields that are supported for the weight_scale message. BMI is not one of them, which is why you are getting an error. 

  • Thanks Ben. 

    I had delved into java & had already found the file you mentioned, I was considering trying to edit it to add BMI field, possibly more, but I'm not a programmer/software person, but a retired hardware design engineer.

    Guess I can save the original & edit to see what happens!

    Unless you have any tips to guide me on what I need to do to add more fields?  :-)