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

Updated on Monday, September 9, 2024

Comments Page 16

Return to post.

Comments

Nadezda

Hi Robert,

I've find reason of my 403 error:

"datasource not found or not readable: derived:com.google.weight:com.google.android.gms:merge_weight".

Look's like I have not weight data, right?

Why it's could happend? I've import weight data in Google Fit app from other one (Picooc) and in GF app I can see weight data. The same sitation with steps and distance butI do not user GF for then.

So, I confuse with it. Could you help me, pls. How to fix it.

Thank you.

Robert Ellison

Quinn - I don't have a sleep tracker so it's going to be hard for me to try and figure that one out. If anyone else has managed this please chime in.

Quinn

Hi Robert,

I wanted to thank you for providing this resource and the detailed steps on how to set this up.

I have found information on the "sleep" metrics on the google fit API in an attempt to add the functionality to read sleep data.

The problem I am running into is that Google fit treats Sleep data as a "session" instead of a "dataset" (steps, distance and weight all fit into this catagory)

Would you be able to provide any insight on how I could possibly read this information? The request URL contains start times and end times which is not present on the ".setscope" URL's that read steps, distance and weight.

It is possible to access this information through the getfitservice/request variable or will this need another function added?

Robert Ellison

Gary, I didn't touch the OAuth consent screen when I got this working. When I look for the project I'm using mine is set to External and everything works fine. For the project the only changes I made were to enable the Google Photos API and set the redirect URL to the script.google.com domain as described below. Given your error it might be that you don't have one of the items that the script is requesting - check the API explorer link near the end of the post to see if that helps. If not, then I'd suggest starting from scratch with a new sheet and a new API project and don't touch any settings relating to the consent screen as you work through setting it up.

Agnes Krawczyk

Hey Gary,

All this GSuite stuff is stuff I never saw during my setup. I think you may have fallen down a rabbit hole at some point. Perhaps Robert has some insight?

Gary

Hey, three others things I've been seeing if would make a difference:

1) 'Secret Manager API' is not enabled. 'Stores, manages, and secures access to application secrets. $0.03/10,000 count'

Not sure I need this, no mention above.

2)'Identity and Organisation' Not sure if I need to complete this...

It seems I'll need a corporate domain and company details.

3)'Policy troubleshooter. Enter the following fields to check if the API call will grant the principal access to a resource.'

Policy troubleshooter' [Principle member e...]

Resource permission pairs'

'Resource: [e.g.] ...265113

Permission [e.g.] Example: "...etIamPolicy"

Gary

Thanks Agnes, Yes - I'm a rookie too!

The Google fitness API status is showing as enabled. However, the 'OAuth consent screen' status is still 'Verification status - Not published'.

The consent is set to 'external'. 'Internal' is only an option for Gsuite users, but it states that 'in this mode, your app is available to any user with a Google Account. External apps that request sensitive or restricted user data must first be verified by Google. This process may take 4–6 weeks. In addition, if you selected restricted scopes, you'll need to go through an independent security review, which can cost $15k–$75k.'

I'm not clear if I've set it up incorrectly so that Google thinks I'm collecting sensitive personal data! Or if the consent page will be published soon.

Agnes Krawczyk

Hi Gary, I had the same problem back in November. I didn't understand how the whole API thing worked, and hadn't enabled the Google fitness API. Once I had that sorted out, it all went well. I just had to make sure the sheet was authorizing properly so it wouldn't return an authorization error every day.

Gary

I've got further! Please ignore my last comment/question. I sorted it out when I realised the 'consent screen' had fields that seemed to be mandatory but weren't.

I am getting error 403 on my sheet though. I'll wait a day or two and see if it's just the authorisation pending, unless the error message copied below suggests to anyone that I need to tweak anything else? (thanks in advance for any help!)

request failed for ...googleapis... returned code 403. Truncated server response: { "error": { "errors": [ { "domain": "global", "reason": "forbidden", "message": "datasource not found or not readable: derived:c... (use muteHttpExceptions option to examine full response).

Gary

Hi

When I try to set up the OAuth consent screen, I'm forced to set up an 'external' one because I don't have a G-Suite subscription. Do I need a G-Suite subscription?

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.