
Google Fit Log Steps
The following steps can be a bit tricky so a video has been provided at the bottom of the page to demonstrate setting up this method. If you are unsure of the steps or when finished setting up get get an error message send me an email or message me through instagram.com/quinn.higgs and ill help you set it up
This method uses adapted code created by Robert Ellison all credit goes to him and his work and I thank him for making this publicly available.
The following steps need to be completed on a laptop/computer
​
-
Open your "steps_rawdata" spreadsheet (This can be found in My drive -> Nutrition tracking -> rawdata)
-
Enter the text Date in cell A1, Steps in B1 and Weight in C1
-
Next select the "Tools" menu and then click 'Script editor...' which will open a new apps script project.
-
Click on the "Resources" menu and then select "Libraries..."
-
Give the apps script project a name (logsteps) and then press "Ok"
-
In the add a library box paste in the following text; 1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF
-
Click "Add, Select the "Version" list and choose the most recent version (largest number)
-
Click "Save"
-
Then select "File" menu click on "Project properties"
-
Copy the Script ID (a long series of letters and numbers) and paste it in a notes/word/text to use later
-
In a new tab go to https://console.cloud.google.com/apis/dashboard
-
Click the "Select a project" button in the blue bar and then click "New project"
-
Name it "logsteps"
-
Back on the Dashboard click "Enable APIs and Services" and find and search and select the "Fitness API"
-
Click the blue "Enable" button
-
You will be prompted to configure consent screen, press this button.
-
Click "External" and then create
-
Under "Application name" enter "logsteps"
-
Scroll down to the bottom and press save
-
Click on "Credentials" on the left hand side (key symbol)
-
Click on "Create credentials" and then "OAuth client ID"
-
Click "Web application" and scroll down to "Authorized redirect URIs"
-
In this box paste the following text; https://script.google.com/macros/d/{SCRIPTID}/usercallback
-
Remove {SCRIPTID} and replace it with the Script ID you saved from a previous step
-
Click the Create button and copy the "Client ID" and "Secret ID" given to you and paste it in a word/notes/pages ocument to use later.
-
Go to https://docs.google.com/document/d/1LSLRgfiZZvUYG7xo0nSmIXjaVMCAixYbKnrHK_EMCWE/edit?usp=sharing
-
Select all the text in this document and copy it to your clipboard
-
Go back to your "logsteps" Google apps script tab on your browser (See image) ->
-
Delete all the current text in the "Code.gs" box and paste the copied text.
-
On the line with the text "var ClientID" paste the Client ID you saved during step 25 in between the apostrophes
-
On the line with the text "var ClientSecret" paste the Secret ID you saved during step 25 in between the apostrophes
-
Save your project by clicking the save icon or going to File -> Save
-
Go back to your "steps_rawdata" google sheet and reload the tab
-
After reloading there will be a Google Fit menu item in the top row. Click on this and select "Authorise"
-
Click "Continue" when prompted
-
When the "This app isn't verified" screen opens, select "Advanced" and then click "Go to logsteps" (The code being used for this does not allow access to anyone accept yourself and all data stays in your ownership)
-
Click "Allow"
-
You will be redirected back to your "steps_rawdata" sheet. Click on the blue underlined "Authorize" text and follow the steps.
-
When completed you should see the text "Success! You can close this tab."
-
Go back to your "steps_rawdata" spreadsheet
-
To manually pull data from your Google Fit account Select Google fit -> Get metrics for yesterday.
​
If you are currently using Google Fit to track your steps you should see yesterdays date and step count pop up after pressing this button. If you receive an error message contact me (contact form at the bottom of the Home page or message me through instagram.com/quinn.higgs) and I will help fix the issue
​
The following steps are to set up the automatic daily retrieval of your step count
-
Go to your "steps_rawdata"
-
Click on the "Tools" tab and then select "Script editor"
-
You will be redirected to your logsteps script. Click the "Edit" tab and then select "Current project's triggers"
-
Click the blue "Add trigger" button in the bottom right corner
-
Under "Choose which function to run" select "getMetrics"
-
Under "Select event source" choose "Time driven"
-
Under "Select type of time based trigger" choose "Day timer"
-
Under "Select time of day" choose "5am to 6am"
-
Click "Save"
-
Go back to your "steps_rawdata" google sheet
-
Click "Share" -> "Get shareable link"
-
Copy the URL of steps_rawdata
-
Open your "Nutrition Tracking" sheet and select the "Settings" tab
-
Paste URL in adjacent cell to steps_rawdata
​
​
To get started, Install Google Fit from Google Play if it’s not already installed.. Then launch the “Fit” app on your Android phone.
You’ll have to set up Google Fit, including giving it access to the sensors it needs to monitor your step count. Google Fit is also compatible with lots of other apps and fitness watches.
​
At this point you're all set. Every day the spreadsheet will automatically update with your step count from the day before and show it on your "Nutrition Tracking" spreadsheet.
​
​
