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

Updated on Friday, December 29, 2023

Comments Page 5

Return to post.

Comments

Jojan

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.

Robert Ellison

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?

Bryan

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.

Rory

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.

valentin

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)

Ondra

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!)

Robert Ellison

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.

Ondra

Hi Robert, me again:)

I adapted the script so that I have to possibility to pull more days at once (as sometimes I do not have the time to to it every day) - like this:

getMetricsForDays(0, 3, 'Metrics'),

I added more functions like this so that I can choose how many days I want to pull (you get the picture, I hope).

Up till yesterday, it was working with no problems, but since yesterday, when I pull more days than one, I get the dates in a strange format. The first day is displayed as before, but second and all subsequent dates get displayed as "day-1 23:00:00"; plus it now adds one more row, which has only date "today 23:00:00" with no other values...

Is there any issue in the script, or could it be a change in the fit API?

m

for people who are getting the "403. Truncated server response: { "error": { "code": 403, "message": "datasource not found or not readable" error- the issue for me was that I didn't have data for all of the data types the script looks for in my Google Fit account (hence it not finding it...). The way to solve it was to remove the bits about the data types I didn't need, and leave in the bits I do want to keep

Cheers!

Robert Ellison

Gustavo, I can't help much more as I don't have a lot else in my account. The trick is to look for the data source name and ID, and to check if you need any additional OAuth scopes.

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