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

Updated on Friday, April 28, 2023

Comments Page 2

Return to post.

Comments

yubin

Thank you for good information. Thanks for completing all the steps.

However, when I try to load yesterday's data or load data from 60 days ago, "Error: Access not granted or expired." appears and no data is entered. How can I solve this?

Chris Chin

I'm not tech savvy and most blogs make my eyes roll over. Thanks for writing this up as it was super easy to follow even with Google changing the names of some of the functions you used. After going back and forth with the API bit, I got it working easily. Then I ran into the 90 day max history thing and found the workaround in the comments.

Thanks a bunch! I've been wanting to graph my weight over the past few years but Google Fit's app only shows you calendar years. This worked great.

Robert Ellison

I don't have this so no way to debug it. I think you'll probably need to post this in the Google forums and see if anyone there can help. Please post back if you find out.

Sebastian

Hi Robert,

I haven't seen anybody conquer the body fat percentage code.

In the API explorer there is no Data Source ID for the data name. It returns:

{

"dataSource": []

}

Where do you go from here?

Guga Alves

And if your want to format distance as Kilometers, change "distance = json.bucket[b].dataset[2].point[0].value[0].fpVal;" to "distance = (json.bucket[b].dataset[2].point[0].value[0].fpVal) / 1000;"

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.

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.

Newsletter

Related

Average Server Response Time in Azure Metrics