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

Updated on Friday, December 29, 2023

Comments Page 18

Return to post.


Agnes Krawczyk

Hello Robert, thank you for putting this together. I was preparing to transcribe 4 years' worth of weight data by hand and now I won't have to, once I tweak the code to import 1500 records or so.

Unfortunately, I am getting the exact same 403 error as Matthias. I hope it resolves overnight for me as well.

I keep thinking that my problem is with my API not being enabled. I'm not sure how to determine whether or not it is. When I click "Enable APIs and Services", I get a list of out-of-box APIs, with mine nowhere to be found. So if that is the problem, I am at a loss for how to correct it.

For now, I will just hope that it will resolve overnight for me, but in case it doesn't, some insight into enabling custom APIs would be awesome. Google's documentation was not helpful, nor was the rest or the internet.

Thanks again!


Darren Wall

All working now, thanks Robert. I'll continue to follow this article to see what others people do with it. Now to "gamify" my step counts and get moving. Enjoying coding doesn't generally encourage exercise.


Aha! I had kept the brackets in there. Works beautifully now! Thanks.

Robert Ellison

Kevin, the redirect URL looks like https://script.google.com/macros/d/{SCRIPTID}/usercallback. You need to replace {SCRIPTID} with the actual ID (select 'Project properties' from the File menu and find the Script ID in the spreadsheet script editor). If the script id is 1234 then the URL is https://script.google.com/macros/d/1234/usercallback


Robert - this is a great guide - thanks for putting this together.

I am stuck on the redirect URL, though. When I enter it in the API console,

it gives me an error:


Request contains an invalid argument.

Tracking Number: c3721854952865243

Send feedback

In the Google sheet, the Fit menu shows up, as does the sidebar. When I click activate on the sidebar, it takes me to a an error page:

Error: redirect_uri_mismatch

Any ideas?




Well done! I could follow this easily and get my spreadsheet up and running in 10 minutes. Kudo's to you!

Robert Ellison

Darren, sorry for the slow response. Yes, click on Credentials and then look under OAuth 2.0 client IDs. If you have client listed click the name to go to a page that has the client ID and secret. If not, click Create credentials and pick the OAuth client ID option. Let me know if you're still having any problems.

Darren Wall

This is exactly what I was looking for but I appear to be stumbling with either a newbie error or a change to the Google API Console ?

Trying to follow the instructions step by step and nothing seems to match after I've added the Fitness API?

The next step says to "go to Keys" has this been renamed to "Credentials"?

From there on I'm not able to find things like the application type, redirect URL and most importantly the Client ID and Client Secret.

Any help would be greatly appreciated.




Thank you for the great job! Worked fine. Fantastic tips from the comments too.


Thank you! I got it working and it was neat. I got a little lost in the "Open the Google API Console" paragraph but worked it out and was able to retrieve my data and learn more about Google APIs in the process. I feel powerful! Thanks.

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.