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

Updated on Friday, December 29, 2023

Comments Page 10

Return to post.


Kai Lansdell

Gotcha, didn't realize it expected a "history"sheet. Must've missed it. Thanks you for the help!

Robert Ellison

Darren - I have seen the email but not had a chance to check it in detail. The current code uses read scopes so that should be OK. I don't know what the changes to the sensitivity mean for the OAuth flow yet. If there is a breaking change I will try to fix it.

Robert Ellison

Kai - Could be the same problem? The history version expects a sheet called History so you'll see the same error if the sheet doesn't exist.

Darren Wall

Google have sent out an email referring to changes in the Google Fit API. Will these changes require any update to the code above?

Kai Lansdell


I am also getting the "Cannot read property 'appendRow' of null" when trying to pull data from the past 60 days. Pulling data from today works fine. Does this function not work or does this script only have the ability to pull data from the day it is authorized?

Thank you!


Ah that was it...thanks!

Robert Ellison

Mike, sounds like it's not loading the sheet. It expects the sheet to be called Metrics. If it has a different name then this is the error I'd expect.


Thank you for putting this together. I worked through all of the authorization issues, but now I'm getting "TypeError: Cannot read property 'appendRow' of null". I tried outputting the json to the Logger and it seems to be blank. Am I missing some required config? I'm using your code and the only thing I've updated is the Client ID and Secret.

Thanks again,


Robert Ellison

John - From your project in APIs and Services (Google Developer Console) click Credentials in the left menu, then the edit icon next to your OAuth2.0 Client, you can add the redirect URI at the bottom of that screen.

Robert Ellison

Hi Alexander, glad you figured out the history. For the authentication problem please follow the instructions in the second to last paragraph of the post to reset your credentials and try again.

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.