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

Updated on Friday, December 29, 2023

Comments Page 9

Return to post.




i have 2 problems. I followed the procedure as described, copied the code and activated the hourly routine but I get an unexpected result:

I get the result of two days ago and not "yesterday".

If I proceed manually instead I get the desired result.

In both cases I get "calories" only a part of them after 24 hours. and all those actually consumed after 48 hours....

could you help me?


"Then choose Web Application as the application type. You need to set the name and the authorized redirect URL."

Where do I do that?


Massive thanks for this tutorial, I've been trying to get it to work for 3 days and finally managed it by using Google Chrome and going through each step very slowly.

I've outputted the information through Grafana as well as Strava info, my email was sent along with this comment if you are ever interested to see an output.

Thanks again for the work you put in.

Kjetil Nygård

Did you manage to get the sleep data?


Hello Robert,

Sorry for all my messages.

I think the problem was with Google Fit.

Indeed, I retrieved the data from my FitBit bracelet via the FitToFit application to Google Fit.

Having some synchronization problems with this application, I switched this morning to another application allowing me to synchronize my FitBit with Google Fit.

So I deleted all the data from my Google account and restarted a synchronization with this new application.

Since the steps (the weight and the distance are not in my Google Fit) are well recovered.

I will now see to retrieve the sleep data.

Thank you very much for your script and your assistance.

Have a good day.



Thanks for your response Robert.

Unfortunately I tested (manually adding weight data in my Google Fit App so there is something to retrieve) but that doesn't change my problem, I still end up with the date without any other data.

I will continue to seek a solution.

Thanks for this work.


Robert Ellison

Benoît - my best suggestion would be to go back to the original code including weight and see if you still have a problem. Could be that something broke when you removed that section.


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.



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.

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.