Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio

I’d like to introduce my experimental repository, which can calculate workout scores on a Spreadsheet with Google Apps Script compiled by clasp. This can leave workout logs in a Spreadsheet and calculate scores automatically.

https://github.com/uuta/…


This content originally appeared on DEV Community and was authored by uuta

I'd like to introduce my experimental repository, which can calculate workout scores on a Spreadsheet with Google Apps Script compiled by clasp. This can leave workout logs in a Spreadsheet and calculate scores automatically.

Problem Statement

While numerous applications handle workout logs, especially for mobile devices, very few of them are integrated with BI tools like Looker Studio. As I aggregate various information in Looker Studio, I would like to be able also to view my workout logs within Looker Studio.

Workout score

Development Motivation

  • Visualize my workouts in Google Looker Studio.
  • Avoid the hassle of database management as much as possible.
  • Develop this within a free range as I will be using it for personal purposes only.
  • Quantify the intensity of my workouts based on weight and reps.
  • Not create the UI for entering weight and reps from scratch as it would take a lot of time.

Tech Stack

  • Typescript
  • Clasp
  • Google Apps Script
  • esbuild
  • prettier

What I've Done

Implemented the aggregation of scored workout logs in a Google Spreadsheet using Google Apps Script.

const workoutTitles: Record<string, WorkoutEntities> = {
  'Incline dumbbell press': {
    category: 'chest',
    youtubeUrl: '8iPEnn-ltC8&ab_channel=ScottHermanFitness',
  },
  . . .
  // add properties if you want
}

Google Form

How to use

Here's how to use this repository after git clone.

1. Open a blank Google Spreadsheet

blank spreadsheet

2. Open the script editor

script editor

3. Copy the script ID from the URL

Copy the script ID from the URL of the script editor which is like the below.

https://script.google.com/home/projects/<scriptId>/edit

4. Build and push the project

Run the following command in the project directory.

$ yarn run push

5. Run updateWorkoutLogs function

run function

6. Set the trigger

Set the trigger to run the main function every 5 minutes. The main function can calculate the scores with the workout logs based on each weight and count.

Set the trigger

7. Check the scores

The calculated scores can be integrated with BI tools like Google Looker Studio. Check the maximum weights and daily scores

Check the scores

Challenges

  • The handling of timezone and locale is not robust. There are places where I've tried to convert the string date values in the spreadsheet cells to Date objects using new Date(). However, depending on the timezone and locale settings, the spreadsheet may change the date format, causing the new Date() function to fail and result in errors.

Repository


This content originally appeared on DEV Community and was authored by uuta


Print Share Comment Cite Upload Translate Updates
APA

uuta | Sciencx (2024-07-27T11:33:55+00:00) Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio. Retrieved from https://www.scien.cx/2024/07/27/building-a-google-apps-script-workout-logger-track-and-visualize-your-fitness-progress-with-spreadsheets-and-looker-studio/

MLA
" » Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio." uuta | Sciencx - Saturday July 27, 2024, https://www.scien.cx/2024/07/27/building-a-google-apps-script-workout-logger-track-and-visualize-your-fitness-progress-with-spreadsheets-and-looker-studio/
HARVARD
uuta | Sciencx Saturday July 27, 2024 » Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio., viewed ,<https://www.scien.cx/2024/07/27/building-a-google-apps-script-workout-logger-track-and-visualize-your-fitness-progress-with-spreadsheets-and-looker-studio/>
VANCOUVER
uuta | Sciencx - » Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/27/building-a-google-apps-script-workout-logger-track-and-visualize-your-fitness-progress-with-spreadsheets-and-looker-studio/
CHICAGO
" » Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio." uuta | Sciencx - Accessed . https://www.scien.cx/2024/07/27/building-a-google-apps-script-workout-logger-track-and-visualize-your-fitness-progress-with-spreadsheets-and-looker-studio/
IEEE
" » Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio." uuta | Sciencx [Online]. Available: https://www.scien.cx/2024/07/27/building-a-google-apps-script-workout-logger-track-and-visualize-your-fitness-progress-with-spreadsheets-and-looker-studio/. [Accessed: ]
rf:citation
» Building a Google Apps Script Workout Logger: Track and Visualize Your Fitness Progress with Spreadsheets and Looker Studio | uuta | Sciencx | https://www.scien.cx/2024/07/27/building-a-google-apps-script-workout-logger-track-and-visualize-your-fitness-progress-with-spreadsheets-and-looker-studio/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.