I made a little app

Hi All,

I made myself a little app so I can quickly see the metrics that are important to me. Its not a replacement for the website, just a little adjunct.
I used appsheet connected to a google sheet that downloads the csv data from intervals when I do log a workout on strava.

here are some screenshots. Appsheet is “no code” but it is a bit clunky and frustrating at first. But it is a way to simply represent whatever you want in a small-screen-friendly way







14 Likes

Looks nice, is it public? Wher to find…

This is cool, thank you! I’m a techie and had never heard of Appsheet until your post and after about a half hour, I was able to create something similar (albeit not as pretty). And don’t worry, I destoyed :slight_smile:

I’m glad it was useful for you.

One day I’ll make a copy with some dummy data and share it here, then people can configure it to display whatever they like.

3 Likes

let’s not wait so long :grinning:

1 Like

OK. I think I have the appsheet app in a shareable form. I don’t want to pay an appsheet subscription, so I can’t deploy it properly but I can share the app with you so you can use it as a basis for whatever you want to display. Its not as nice as subintervals but you can configure it to your heart’s content.

You need an appsheet account, a google drive account and a google sheets account. (and intervals obviously)

You need to open this link
https://www.appsheet.com/Template/AppDef?appName=IntervalsLogDemo-66873143&utm_source=share_app_link

in your browser.

And you also need this code




function populateSheetWithCSV(sheet, csvUrl, user, pw) {
// request the CSV!
    var resp = UrlFetchApp.fetch(csvUrl, {
        headers: {
            // use basic auth
            'Authorization': 'Basic ' + Utilities.base64Encode(
                    user + ':' + pw, Utilities.Charset.UTF_8)
        }
    });
// parse the response as a CSV
  var csvContent = Utilities.parseCsv(resp.getContentText());


  // Replace any instances of "Infinity" or "NaN" with an empty string
    for (var row = 0; row < csvContent.length; row++) {
        for (var col = 0; col < csvContent[row].length; col++) {
            if (csvContent[row][col] === "Infinity" || csvContent[row][col] === "NaN") {
                csvContent[row][col] = "";
            }
        }
    }
//    var csvContent = parseCsvResponse(resp.getContentText());
// clear everything in the sheet
// set the values in the sheet (as efficiently as we know how)
    sheet.getRange(
        1, 2,
        csvContent.length /* rows */,
        csvContent[0].length /* columns */).clearContent().setValues(csvContent);
}



function downloadAndSaveCSV() {
  const scriptProperties = PropertiesService.getScriptProperties();
  const apiKey = scriptProperties.getProperty('apiKey');
  const athleteID = scriptProperties.getProperty('athleteID');

  if (!apiKey || !athleteID) {
    console.error("Error: Missing required properties.");
    if (!apiKey) {
      console.error("apiKey is missing or invalid.");
    }
    if (!athleteID) {
      console.error("athleteID is missing or invalid.");
    }
    return false;  // Indicates that properties are invalid
  }
  

  try {
   

// First  the activity data
    var sheet = SpreadsheetApp.getActive().getSheetByName('Activities');
    populateSheetWithCSV(sheet,"https://intervals.icu/api/v1/athlete/" + athleteID +"/activities.csv","API_KEY", apiKey);
  

// Now the wellness data
    var sheet = SpreadsheetApp.getActive().getSheetByName('Wellness');
    populateSheetWithCSV(sheet,"https://intervals.icu/api/v1/athlete/" + athleteID +"/wellness.csv","API_KEY", apiKey);

  } catch (error) {
    console.error("oops");
    Logger.log('Error: ' + error.message);
  }
}


I will make a video to show you what to do next.

2 Likes

Here’s a video explaining how to copy the app and configure it for your data and set a trigger so it downloads the data every night. I’ll post another video explaining how to get it to update data after an activity.

I should have said at the end of the video, that once you’ve set up the app, install appsheet on your phone from the play store or app store, login with the same account you’ve used on the web app and select the Intervals Log Demo app. There’s an option to add an icon to your homescreen too.

I recorded it with QuickTime and it came out very low res/blurry but you can still see what I’m doing. Sorry about that. You can probably run it at 1.5 speed and still understand it.

1 Like

Your video is private!

Oh! Is it fixed now?

Yep! Thanks!

I’m getting a mismatch in the Wellness table - schema has 43 columns and the table has 44 columns.
Tried regenerating the table, but no solution. I’ll poke around a bit more…

Is that after you synced with your own data?

Usually regenerating fixes everything. :confused:

Yes, I can see my own data in the spreadsheet.

Think I sorted the ‘regenerate schema’…was just a matter of finding the right place to select it!

1 Like

It’s very neat - I think I’ll have a play with AppSheet.
Many thanks for this.

Nice work!

One thing I noticed - which wouldn’t have happened for you - is that, when it loads in my data, it leaves some of your data (Activities, Wellness) from the original copy process. It’s simply because you have more rows of data than me and the code specifically clears down only the number of rows/columns it’s going to add in. I just went to the spreadsheet and deleted your rows myself. I don’t think it would have been noticeable in the app because I have over a year’s data - but I thought it was worth mentioning.

1 Like

Oh right. Thanks for pointing that out.

So as promised, here is the second video explaining how to automatically download intervals data after an activitiy.

You need a strava account and a zapier account. Both free.

I think this method might be generally applicable for people who want to automatically transfer intervals data somewhere after an activity.