Export Google Fit Daily Steps, Weight and Distance to a Google Sheet

Updated on Sunday, January 26, 2025

Comments Page 10

Return to post.

Comments

Benoît

Hi Robert,

You can delete my previous message if you want because after several attempts, I deleted everything, turn off the pc and I only got back to it this evening.

I no longer have an error message now (I don't know what was before).

However, I have a new problem: the dates increment well, but not the steps or the distance (I deleted the information relating to the weight because it is not present in my Fit account).

Sincerely sorry to bother you, but I don't understand a thing. In my API dashboard I have no more errors now but the data does not seem to recover.

Thanks in advance if you have a solution.

Benoît

Benoît

Hi Robert,

First of all thank you for this script which will allow me to be able to correctly follow my activity.

Unfortunately, I get stuck on the error message "Error: Access not granted or expired.".

I tried the different information that I read in the comments in addition to those in your article.

I started from the beginning 3 times and still have the same problem. My API is activated, access is authorized, in short I do not understand.

Thank you in advance.

Benoît (sorry for my english, i'm french)

Robert Ellison

A quick note on the 'Updates to Google Fit's Developer Policy and APIs' email. After reviewing the requirements for sensitive scopes there is an exception for personal use:

Personal Use: The app is not shared with anyone else or will be used by fewer than 100 users (all of whom are known personally to you). Note that your app will be subject to the unverified app screen and the 100-user cap will be in effect.

So using this script to export your own Google Fit data will continue to be allowed without any Google review. If you have used this script to create a service that other people use then you probably do need to be prepared to have Google review your implementation.

Kai Lansdell

Gotcha, didn't realize it expected a "history"sheet. Must've missed it. Thanks you for the help!

Robert Ellison

Darren - I have seen the email but not had a chance to check it in detail. The current code uses read scopes so that should be OK. I don't know what the changes to the sensitivity mean for the OAuth flow yet. If there is a breaking change I will try to fix it.

Robert Ellison

Kai - Could be the same problem? The history version expects a sheet called History so you'll see the same error if the sheet doesn't exist.

Darren Wall

Google have sent out an email referring to changes in the Google Fit API. Will these changes require any update to the code above?

Kai Lansdell

Hello,

I am also getting the "Cannot read property 'appendRow' of null" when trying to pull data from the past 60 days. Pulling data from today works fine. Does this function not work or does this script only have the ability to pull data from the day it is authorized?

Thank you!

Mike

Ah that was it...thanks!

Robert Ellison

Mike, sounds like it's not loading the sheet. It expects the sheet to be called Metrics. If it has a different name then this is the error I'd expect.

Add Comment

All comments are moderated. Your email address is used to display a Gravatar and optionally for notification of new comments and to sign up for the newsletter.