Mountain bike training plans. Mountain bike coaching.

Start Training

How to merge two .csv files as one workout?

Home MTB Training and Racing Forums Athlete Support Forum How to merge two .csv files as one workout?

  • This topic is empty.
Viewing 11 reply threads
  • Author
    Posts
    • #5548

      I use a LeMond exercise bike that has a time limit length for workouts of 99 minutes due to the display only being able to show 4 digits in the timer (at least that's my guess why the 99 minute time limit is there).  The console takes a USB flash stick to download/upload workouts.  For the moment, what happens after 99 minutes when I am doing one of the endurance rides on the weekend is the bikes shuts off after the first 99 minutes of the training session and that session is downloaded as one .csv file.  Then I start the bike up again and finish my workout which is then downloaded as a second .csv file when I am finished.  For instance yesterday, my session was 2 1/2 hours.  So I did 99 minutes, and 51 minutes respectivley in terms of the .csv files, but with only a three second pause between the two while on the bike.

      I would like to be able to merge these two files into one since it is one workout and upload the merge to Training Peaks (I have a Mac, so WKO is out).  Has anyone done this successfully or know how to do it?  It seems there is an application for Mac called Bulk File Merger that will merge two .csv files, but it's a $50 program and before I buy, I would like to know if that would do the trick – or if there is an alternative that someone uses and could recommend.

       

      Or do I just submit the two .csv files to Training Peaks as two separte workouts and not worry about it?

       

      Thanks for any help.

    • #7583
      DaveDave
      Keymaster

      If you are familiar with (and not terrified of) the terminal, try this. 

      Combining csv files can be done with the 'cat' utility in terminal. The 'cat' (for concatenate) command combines files, and this will work fine in your situation with a few changes beforehand. It goes like this:

      1. Make a temporary directory, I'll call it temp. Place a copy of your workout files in this directory. Since we will make changes this is very important!

      2. csv files are simple text files where the first row contains data headers and all other rows contain a data point. You only want the headers from the first file, so open the 2nd workout file in your favorite text editor (TextEdit.app is good) and delete the header row (I'm not familiar with the LeMond file format, there may be more than one row to delete).

      3. Open the first workout file in a text editor. Go to the end of the file, and make sure the cursor (in TextEdit.app) will drop below the last line of text using the down arrow key. If it won't, hit the enter key once and save the file. If there is no end of line character after the last line in the first file the last entry of the first file gets combined with the first line of the 2nd file…this may or may not be necessary, and once you figure it out it will be the same every time.

      4. Open terminal. cd to your temp directory with the edited workout files. Type 

      cat w1.csv w2.csv >merged.csv

      where w1 is the first workout and w2 is the 2nd workout. If all went well merged.csv (in the temp directory) will be the file you need. 

    • #7584

      Dave, this sounds like a fun experiment.  Thank you so much for the instructions.  I have never used Terminal before, but I see it in my Utilities Folder and will give it a go with the two workouts from yesterday to see what happens.

      In addition, I heard back from Bulk File Merger and their program will do it if I purchase the PRO version which is $79.95!!!Surprised

    • #7585

      Update – I tried the demo version of Bulk File Merger PRO which allows me two files for a total of 4 times before the demo expires.  The first attempt resulted in a file that Training Peaks could not read and gave an error message.

       

      So now I will try Dave's method…

    • #7590
      AvatarMatt
      Participant

      That sounds like a lot of work.

       

      You can upload numerous files within the same workout in TrainingPeaks and there will be an “automerge” file that shows up as the last option in the box thatshows the files you've uploaded.  Click on the little button next to that option and then press the Recalculate button.  It'll show up as one workout then. 

       

      Hope that makes sense.

    • #7592
      DaveDave
      Keymaster

      Thanks for that Matt – nothing is easier than a button click 😉

      SingingSingleTracker let us know how that works.

    • #7602

      Matt said:

      That sounds like a lot of work.

       

      You can upload numerous files within the same workout in TrainingPeaks and there will be an “automerge” file that shows up as the last option in the box thatshows the files you've uploaded.  Click on the little button next to that option and then press the Recalculate button.  It'll show up as one workout then. 

       

      Hope that makes sense.

      Thanks Matt!!! 

      I just tried that, but it is not working.  It doesn't work in the Beta or the Classic.  I am able to download two files, the auto merge pops up.  I hit recalculate and the total time stays the same as if I had just uploaded one file (the two are not added or merged).  I wonder what I am doing wrong?……Cry

    • #7603
      AvatarMatt
      Participant

      Strange.  I was going to post to make sure that you press the little radio button next to the automerged file name, but I just tried it again in the beta mode and it didn't seem to work.  Must be having some glitches.  Worked perfectly for me last week.  Hope that functionality comes back as it was very handy.

       

      I've attached a picture of what it looked like when it did work.

       

    • #7610

      Yes, I hope that function gets up and running again at Training Peaks.

    • #7611
      DaveDave
      Keymaster

      SingingSingleTracker – send two files to be merged my way and I'll apply my method to it and see how that works. dave at lwcoaching dot com.

    • #7612

      Dave said:

      SingingSingleTracker – send two files to be merged my way and I'll apply my method to it and see how that works. dave at lwcoaching dot com.

      Will do as soon as I can figure out how to send them to you.  Do I add them here as an attachment of is there a message box for you that I should send them?

    • #7627

      Suddenly, the merge feature is working again at Training Peaks!!!  Problem solved for now…

Viewing 11 reply threads
  • You must be logged in to reply to this topic.