I Thought He Came With You is Robert Ellison’s blog about software, marketing, politics, photography and time lapse.

June Gloom

Gloomy cloud over the French Chateau Sanatorium

A relatively pleasant Sunday in San Francisco, which means the second you turn your back fog and low cloud are going to swoop in:

The first part of the video is looking west toward the ocean. Once any trace of blue is obliterated we turn south to see fog rolling over San Pedro Mountain near Pacifica and increasingly gloomy cloud cover over the French Chateau Sanatorium (which I think of as the West Portal Retirement Castle). This is a deeply strange building, nestled in a hollow and surrounded by trees. Most of the time you don't see it and then suddenly, on the right street at the right angle you're startled to realize that there is a massive chateau hiding in the neighborhood.

If you're in the mood for more West Portal oriented time lapse enjoy: West of West PortalWest Portal Mosaic TimelapseWest Portal Timelapse of Timelapses and Spherical Sunset.

Star Trails

Star Trails

Here's a different take on the timelapse I posted yesterday (Jupiter from Casini Ranch):

For this version each frame is built from the cumulative maximum pixel value for all the previous frames. So it's like a long exposure with nice star trails (and Jupiter, and at various points a couple of satellites and a plane).

Average Beach

Average Beach

Limantour beach in Point Reyes.

Jupiter from Casini Ranch

Jupiter from Casini Ranch

A short 4K UHD timelapse featuring Jupiter rising over the Russian River:

Shot from Casini Ranch near Duncan Mills, California. It's a shame it's not Saturn and Cassini Ranch.

Privacy Policy Update and Comment Notifications

The ITHCWY privacy policy has been updated to reflect changes in the blog comment system. Previously email addresses submitted with comments were only used to display a Gravatar. Starting today they will also be used for notifications and newsletter signup.

The first notification is when a comment is approved. You'll always be notified in this case if you enter an email address.

When you leave a comment you can opt in to receiving notifications when another comment is added to the same post.

Finally, you can also subscribe to the monthly newsletter when leaving a comment.

San Francisco Botanical Garden

San Francisco Botanical Garden

San Francisco Botanical Garden

San Francisco Botanical Garden

Bay Bridge Approach

Bay Bridge Approach

San Francisco

San Francisco

Export Google Fit Daily Steps to a Google Sheet

Updated on Saturday, December 8, 2018

Google Fit Daily Step Export

Google Fit is a great way to keep track of your daily step count without needing to carry a Fitbit or other dedicated tracker. It's not easy to get that data out though, as far as I can tell the only way is Google Takeout which is not made for automation. Luckily there is an API and you can do almost anything with Google Sheets.

If you're looking to export your step count this post has everything you need, just follow the instructions below to get your spreadsheet up and running. This is also a good primer on using OAuth2 with Google Apps Script and should be a decent starting point for a more complex Google Fit integration. If you have any questions or feedback please leave a comment below.

To get started you need a Google Sheet, an apps script project attached to the sheet and a Google API Project that will provide access to the Fitness API. That might sound intimidating but it should only take a few minutes to get everything up and running.

In Google Drive create a new spreadsheet and call it whatever you like. Rename the first tab to 'Steps'. Enter 'Date' in cell A1 and 'Steps' in cell B1. To grab history as well create another tab called 'History' with the same headers. Next select 'Script editor...' from the Tools menu which will open a new apps script project.

Give the apps script project a name and then select 'Libraries...' from the Resources menu. Next to 'Add a library' enter 1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF ad click Add. This will find the Google OAuth2 library. Choose the most recent version (24 at the time of writing) and click Save. Then select 'Project properties' from the File menu and make a note of the Script ID (a long series of letters and numbers).

Open the Google API Console. Create a new project and name it something like 'Google Fit Sheet'. From the Dashboard click Enable APIs and Services and find and select the Fitness API. Then go to Keys and create an OAuth Client ID. You'll be asked to create a consent screen, the only field you need to enter is the product name (i.e. 'My Fit App'). Then choose Web Application as the application type. You need to set the name and the authorized redirect URL. The redirect URL is https://script.google.com/macros/d/{SCRIPTID}/usercallback replacing {SCRIPTID} with the actual Script ID you made a note of above. After adding this make a note of the Client ID and Client Secret.

Go back to the apps script project and paste the code below into the Code.gs window:

Right at the top of the code there are spaces to enter the Client ID and Client Secret from the API Console. Enter these and save the project.

Switch back to your Google Sheet and reload. After reloading there will be a Google Fit menu item. First select Authorize... You'll get a screen to authorize the script and then a sidebar with a link. Click the link to authorize the script to access your Google Fit data. You can then close the sidebar and select Get Steps for Yesterday from the Google Fit menu. You should see a new row added to the spreadsheet with yesterday's date and step count.

The final step is to automate pulling in the data. Go back to the apps script project and select Current project's triggers from the Edit menu. Add a trigger to run getSteps() as a time driven day timer - I recommend between 5 and 6am. You can also click notifications to add an email alert if anything goes wrong, like your Google Fit authorization expiring (in which case you just need to come back and authorize from the Google Fit menu again.

At this point you're all set. Every day the spreadsheet will automatically update with your step count from the day before. You can add charts, moving averages, export to other systems, pull in your weight or BMI, etc. I want to add a seven day moving average step count to this blog somewhere as a semi-public motivational tool... watch this space.

If you are looking to extend this sample to other data types then this API explorer page is very helpful for finding data types that the API documentation doesn't list.

News: Facebook defends its simple 2 question survey on the trustworthiness of news publishers

Facebook defends its simple 2 question survey on the trustworthiness of news publishers

What if everyone recognizes a news source and say half of them trust it but it isn't true?