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

Updated on Friday, April 28, 2023

Comments Page 3

Return to post.


Robert Ellison

Hola Antonio, estoy usando Google Translate, así que perdone cualquier error. Sigo viendo la misma pantalla. Vaya a Google Cloud Console y seleccione su proyecto cerca de la parte superior izquierda. Desde la pantalla principal, seleccione API y servicios y luego Pantalla de consentimiento de Oauth y complete todo lo que necesite. A menos que la interfaz sea diferente en Perú, no estoy seguro de qué más podría estar pasando.

Antonio Chian

Hola Robert,

Soy de Perú, no se ingles y es la primera vez que intento hacer algo con la api, estoy estancado en esta parte:

"Then go to Keys and create an OAuth Client ID. You'll be asked to create a consent screen, the only field you need to enter is the product name (i.e. 'My Fit App')."

Despues de encontrar el Fitness API no encuentro la llave donde crear el cliente ID, tal vez sea porque desde que publicaste la api hasta la fecha a cambiado la interfaz, espero puedas ayudarme ya que lo que intento hacer es algo parecido pero con las horas de sueño.

Gracias por la ayuda de antemano y gracias nuevamente por ayudarnos a todos aquellos que tenemos la inquietud por la programación aun que no tengamos los estudios.

Saludos desde Perú.


Hi Robert -

This is a "problem solved", but it might help someone else if they make the same mistake.

Thank you for your patience debugging newbie's efforts. This is my first try at an app or an api. It looked promising, but I get an Error 403: The developer hasn’t given you access to this app. (No one else seems to have gotten this particular one yet.) I've double-checked the url doesn't have curly brackets.

When I test the app function by function, it's getting stuck on getMetricsForDays. Error: Access not granted or expired. (line 466, file "Service". I gather that's a google file.

I figure this should work even in test mode (since I didn't plan to hand it over to anyone else). I tried adding myself as a Test User (since I hadn't published the app) and then I tried Publishing (without review). And ... it presto!

So the missing step (for me) was "publish MyFitApp on the OAuth consent screen".

Thanks for helping me get my head around this environment. I love being able to manipulate my own data finally!

Cheers -



thanks for reply Robert,

seems like there was problem with weight or such, i tried removing the code form appscript for weight and it worked fine.

Robert Ellison

Jojan - 403 is forbidden so check that you have granted access correctly and also try following the instructions to fully remove access and then authorize again.


thanks for the amazing work.

I am getting this problem

Exception: Request failed for https://www.googleapis.com returned code 403. Truncated server response: { "error": { "code": 403, "message": "datasource not found or not readable: derived:com.google.weight:com.google.android.gms:merge_weight.

thank you.

Robert Ellison

According to the documentation distance is in meters. Not sure why you're seeing such a big discrepancy between Fit and the API here. Do steps line up for the same period?


First this is incredible and I'm happy I was able to follow along to get it working, though I have one thing that I am so stuck on.

I for the life of me cannot figure out what exactly is being outputted under "Distance".

An example, for yesterday the Distance walked on Fit was 1.04km. However the output that I get is "2142.894508" which I don't even know what I'm to do with that piece of information that doesn't tie to any distance that I know of.


Really useful article. I've been tearing my hair out for the past few days trying to expand this to include sleep data, but no luck. It'd be very interesting to see whether anyone cracks this in the end, I notice a few other commenters have similar ambitions.


I also had that same date issue, here's an except of my date log



11/7/2021 23:00:00

11/8/2021 23:00:00

11/9/2021 23:00:00

Daylight saving change DID indeed occur on Nov 7, 2021

Before that date, my numbers of steps matched the one I had in the Google fit App, after that date, those numbers won't match.

(oh BTW, Robert, thank you so much for that scriptin the first place)

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.

I Thought He Came With You is Robert Ellison's blog.



Average Server Response Time in Azure Metrics