Google Sheets
Google Sheets is a cloud-based spreadsheet application that allows you to store and query data using a web interface. Evidence supports connecting to Google Sheets as a data source, allowing you to query Google Sheets using SQL.
Plugin
The Google Sheets data source is a plugin, you first need to install the plugin.
Add a New Google Sheets Data Source
- Start the Evidence dev server:
npm run dev
or Start Evidence using the VSCode extension. - Navigate to the settings page,
also accessible via the
...
menu in the top right. - Click the New Source button.
- Select Google Sheets as the data source type.
- Enter the configuration options for the connection.
- Click the Test button to confirm the connection is successful.
- Click the Save button to save the connection.
- Your configuration options are saved in two files:
/sources/[source_name]/connections.yaml
: Non-sensitive values, source controlled./sources/[source_name]/connection.options.yaml
: Sensitive values, not source controlled, base-64 encoded.
Configuration
Adding data from Google Sheets requires a a service account.
To create a service account, see the BigQuery instructions.
- Create a service account, and download the JSON key file
- Give the service account access to your Google Sheet by sharing the sheet with the service account's email address.
- Add the JSON key file to your Evidence app via the Settings page
- In the connections.yaml file, add the sheet id (which can be found in the URL of the Google Sheet, after
https://docs.google.com/spreadsheets/d/
).
name: [your_source_name]
type: gsheets
options: {}
sheets:
[your_workbook_name]: [your_sheet_id]
Query the sheet using the following syntax:
select * from [your_source_name].[your_workbook_name]_[your_tab_name]
Where [your_tab_name]
is the name of the tab in your Google Sheet, with spaces replaced by underscores.