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

Updated on Friday, December 29, 2023

Comments Page 7

Return to post.

Comments

Robert Ellison

James, you'd need to manage OAuth for each user which is going to be fairly complex. I'd approach this by having a sheet for each user and then as a separate process merge everything together into another sheet.

James Chambers

Is this possible to implement this with multiple users? Having all their data displayed in separate rows?

Robert Ellison

Hi Jim, nothing I'm aware of. I'd suggest revoking access from Google Fit, resetting the script and then reauthorizing (see instructions in post). Let me know if you're still having trouble after that.

Jim Rion

Thanks so much for this, it had been really helpful and worked perfectly for about two weeks

Now, I keep getting failure notifications every couple of days and have to go in and reauthorize the Google sheet's API access. It started June 1st. Has something changed on Google's side somewhere?

RB

This is awesome! Thank you!

I was planning to improve my spanish but guess I'll figure out how to add more data - I'm not a programmer.

I had previously spent so much time trying to get google sheet data from google fit. It's way harder than I would have expected.

Do you have a donation page?

Rajat Anand

commenting datasourceid worked for me for getting heart rate data.

{

"dataTypeName": "com.google.heart_rate.bpm"

///"dataSourceId": "derived:com.google.heart_rate.bpm:com.google.android.gms:heart_rate_bpm"

}

Austin

There was an earlier question about converting weight from kg to lb in the script. I see that I can add weight = weight * 2.205; But I'm unsure where to add that.

Austin M Robertson

I was having trouble and getting an Error 403 message when I tried to authorize. To fix the problem make sure you add your google account as a test user on the OAuth Consent screen.

Robert Ellison

Alex, you need to add the scope for calories to the .setScope call. Use the API explorer to find this. You will probably need to reauthorize the script again after adding the scope.

Alex

That's worked. Thanks Robert!

I didn't need distance, and instead wanted calories burnt so I have adapted the script to the below. However, it isn't pulling calories burnt. it is still getting step count and weight though.

var request = {

"aggregateBy": [

{

"dataTypeName": "com.google.step_count.delta",

"dataSourceId": "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps"

},

{

"dataTypeName": "com.google.weight.summary",

"dataSourceId": "derived:com.google.weight:com.google.android.gms:merge_weight"

},

{

"dataTypeName": "com.google.calories.expended",

"dataSourceId": "derived:com.google.calories.expended:com.google.android.gms:from_activities"

}

Any ideas? 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.

Newsletter

Related

Average Server Response Time in Azure Metrics