<p>I am using Stackdriver to monitor the clusters deployed in Kubernetes in GCP. In Stackdriver monitoring overview tab, I am able to see different charts showing resource utilization vs time. I want to convert this charts to a csv file which contains the resource utilization for every second. Has anyone done this before or have an idea of how to do it?</p>

<p>There isn't an "easy" way built into Stackdriver to export metrics to a .csv file.</p>

<p>Probably the "easiest" way is by using this project on github that is a Google App Engine service to export to a .csv file.  It is in Alpha, and you need to install it.
<a href="https://github.com/CloudMile/stackdriver-monitoring-exporter" rel="nofollow noreferrer">https://github.com/CloudMile/stackdriver-monitoring-exporter</a></p>

<p>The recommended way to export is explained here.  <a href="https://cloud.google.com/solutions/stackdriver-monitoring-metric-export" rel="nofollow noreferrer">https://cloud.google.com/solutions/stackdriver-monitoring-metric-export</a>
and this method is geared toward archiving large amounts of metric data for later comparison, not really for smaller amounts to a spreadsheet.</p>

<p>The recommended way requires using the Monitoring API
(<a href="https://cloud.google.com/monitoring/custom-metrics/reading-metrics" rel="nofollow noreferrer">https://cloud.google.com/monitoring/custom-metrics/reading-metrics</a>) 
which returns JSON, which you'd have to convert to a .csv file.  You could probably get curl or postman to make the calls.</p>

<p>Here's an other example project on github.  This sends the data to bigquery for storage though.
<a href="https://github.com/GoogleCloudPlatform/stackdriver-metrics-export" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/stackdriver-metrics-export</a></p>
