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

Updated on Friday, December 29, 2023

Comments Page 4

Return to post.

Comments

Guga Alves

If you use sheet.clear(), headers will be removed too, so you would prefer clearing only content after the second line.

I found a good way for that at https://stackoverflow.com/questions/71494974/how-to-clear-values-from-range-keeping-headers-in-google-sheet-script

Robert Ellison

Call sheet.clear(); right before sheet.appendRow(...);.

David

Hi Robert and all! Great tool, thx a lot!

How can I make the script to overwrite the results of the previous day on the Metrics tab? I would like to have only one row with the latest result.

Robert Ellison

Tendrá que usar API Explorer para limitar la solicitud a los datos que están disponibles, o probar con una cuenta que tenga los campos que se solicitan.

Antonio

Hi Robert, gracias por responder tan pronto;

Si pude configurar la ID del cliente, ahora el error que tengo es el que casi todos tienen:

"Excepción: No se pudo completar la solicitud para el código devuelto 400 de https://www.googleapos.com. Respuesta del servidor truncada:{"error":{"message":"Requiere ay least one... (usar la opción muteHttpExceptions para examinar toda la respuesta)."

Creo que el error se debe a qué yo no tengo datos de pasos ni peso y ya que no guardo datos me da error, la pregunta es se puede controlar dicho error?. Lo otro es que yo quiero sacar datos de sueño y que uso mi band de Xiaomi con el aplicativo Zeep Life al cuál he conectado con Google Fit, dicho esto los dos aplicativos se sincronizan perfectamente; pero quiero probar si puedo sacarlo los datos a el Google sheets. Espero puedas entenderme, gracias.

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ú.

Renee

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 -

Renee

Jojan

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.

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.

Newsletter

Related

Average Server Response Time in Azure Metrics