Comments
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
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.
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.
thanks for the amazing work.
I am getting this problem
Exception: Request failed for https://www.googleapis.com returned code 403. Truncated server response: { "error": { "code": 403, "message": "datasource not found or not readable: derived:com.google.weight:com.google.android.gms:merge_weight.
thank you.
According to the documentation distance is in meters. Not sure why you're seeing such a big discrepancy between Fit and the API here. Do steps line up for the same period?
First this is incredible and I'm happy I was able to follow along to get it working, though I have one thing that I am so stuck on.
I for the life of me cannot figure out what exactly is being outputted under "Distance".
An example, for yesterday the Distance walked on Fit was 1.04km. However the output that I get is "2142.894508" which I don't even know what I'm to do with that piece of information that doesn't tie to any distance that I know of.
Really useful article. I've been tearing my hair out for the past few days trying to expand this to include sleep data, but no luck. It'd be very interesting to see whether anyone cracks this in the end, I notice a few other commenters have similar ambitions.
I also had that same date issue, here's an except of my date log
11/6/2021
11/7/2021
11/7/2021 23:00:00
11/8/2021 23:00:00
11/9/2021 23:00:00
Daylight saving change DID indeed occur on Nov 7, 2021
Before that date, my numbers of steps matched the one I had in the Google fit App, after that date, those numbers won't match.
(oh BTW, Robert, thank you so much for that scriptin the first place)
Hi Rob, thanks for the quick reply.
I also noticed that I have different-yet-similar issues with my other google fit connections, which together with the time they emerged suggests they might be tied to the change to daylight saving time.
I will definitely try to set the trigger (which I do not remeber being here when I first got the script from you, by the way, thanks!)
Hi Ondra. I don't think it's the script. I just tested pulling 60 days and got reasonable dates. Could be something in your sheet - check the format for the column.
I'd also suggest setting up a trigger, see the instructions in the post. That way you don't need to remember to use the menu, it will just pull in the last day every day.
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.