Google Sheets data source provisioning
You can define and configure the Google Sheets data source in YAML files with Grafana provisioning. For more information about provisioning a data source, and for available configuration options, refer to Provision Grafana.
You can provision the data source using any of the following authentication mechanisms:
With an API key
To create the API key, refer to Authenticate with an API key.
Example
The following YAML snippet provisions the Google Sheets data source using API key authentication.
Replace <API KEY>
with your API key, and replace <DATA SOURCE NAME>
with the name you want to give the data source.
apiVersion: 1
datasources:
- name: '<DATA SOURCE NAME>'
type: grafana-googlesheets-datasource
enabled: true
jsonData:
authenticationType: 'key'
secureJsonData:
apiKey: '<API KEY>'
version: 1
editable: true
With a service account JWT
To create a service account and its JWT file, refer to Authenticate with a service account JWT.
Example
The following YAML snippet provisions the Google Sheets data source using service account JWT authentication.
Replace <PROJECT ID>
, <CLIENT EMAIL>
with your service account details, <PRIVATE KEY DATA>
with your JWT key data, and replace <DATA SOURCE NAME>
with the name you want to give the data source.
apiVersion: 1
datasources:
- name: '<DATA SOURCE NAME>'
type: grafana-googlesheets-datasource
enabled: true
jsonData:
authenticationType: 'jwt'
defaultProject: '<PROJECT ID>'
clientEmail: '<CLIENT EMAIL>'
tokenUri: 'https://oauth2.googleapis.com/token'
secureJsonData:
privateKey: <PRIVATE KEY DATA>
version: 1
editable: true
With the default GCE service account
You can use the Google Compute Engine (GCE) default service account to authenticate data source requests if you’re running Grafana on GCE.
Example
The following YAML snippet provisions the Google Sheets data source using the default GCE service account for authentication.
Replace <PROJECT ID>
with your GCE project ID and replace <DATA SOURCE NAME>
with the name you want to give the data source.
apiVersion: 1
datasources:
- name: '<DATA SOURCE NAME>'
type: grafana-googlesheets-datasource
enabled: true
jsonData:
authenticationType: 'gce'
defaultProject: '<PROJECT ID>'
version: 1
editable: true