Log State to Google Sheet

I’m wondering if there are any SmartApps or code samples where people are writing device states to Google Sheets. For example, if I want to log energy usage from a monitor or temperature from a sensor.

This seems to be an easy way to create a database of states that could be time stamped for analysis.

You could do it with IFTTT: