Thank you one more time, Robert. The problem is solved somehow. :) Since Im getting constant errors in downloading Daily Summaries from Google Takeout yor script is very useful for me.
Chi, Alex, not sure what could be wrong. Try removing auth from the Fit app and the spreadsheet and then reauth both. Alex, check the API is enabled as well. Chi, sometimes the auth screen gives you the option to limit access to a certain amount of time, could that be the issue?
Recently, I keep getting a time-based error every morning. The Error is: Access not granted or expired. I do go in a re-authorize, and then have it Get Metrics and it works. But then the same issue happens the next morning. How do I get it to do what it was doing before? I went back to your instructions, but I still had the issue today.
Robert, thank you for your work! I did everything according your explanation. When I try to get Metrics, I get red error message "Error: Access not granted or expired.Details". Did it several times but problem is stiil here. Thanx in advance.
Nadezda - most likely it's an authorization problem. Follow the steps above to remove authorization and then re-authorize. If this doesn't clear it check the API explorer link to make sure you can see weight data that way.
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.
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.
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?
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.
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?
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.