Google Sheets #
Use a Google Sheets catalog to configure access to a Google Sheets spreadsheet.
Follow these steps to begin creating a catalog for Google Sheets:
- In the navigation menu, select Catalogs.
- Click Create catalog.
On the Select a data source pane, click the Google Sheets icon.
- Follow the instructions in the next sections to configure your Google Sheets connection.
Define catalog name and description #
The Name of the catalog is visible in the Query editor and other clients. It is used to identify the catalog when writing SQL or showing the catalog and its nested schemas and tables in client applications.
The name is displayed in the Query editor, and when running a SHOW
CATALOGS command. It is used to fully
qualify the name of any table in SQL queries following the
catalogname.schemaname.tablename syntax. For example, you can run the
following query in the sample cluster without first setting the catalog or
SELECT * FROM tpch.sf1.nation;
The Description is a short, optional paragraph that provides further details about the catalog. It appears in the Starburst Galaxy user interface and can help other users determine what data can be accessed with the catalog.
Authentication to Google Sheets Catalogs #
Access to Google Sheets catalogs requires authentication using API keys.
Create a JSON-formatted API key for your Google Cloud account.
Test the connection #
Once you have configured the connection details, click Test connection to confirm data access is working. If the test is successful, you can save the catalog.
If the test fails, look over your entries in the configuration fields, correct any errors, and try again. If the test continues to fail, Galaxy provides diagnostic information that you can use to fix the data source configuration in the cloud provider system.
Connect catalog #
Click Connect catalog, and proceed to set permissions where you can grant access to certain roles.
Set permissions #
This optional step allows you to configure read only access to the catalog.
Click Skip to go straight to adding the catalog to a cluster. If you skip this step, you can add read only access to your catalog for any Starburst Galaxy role later. Skipping this step leaves only the following roles with access to schemas and tables in the catalog:
- Administrative roles.
- The currently logged-in role that created the catalog.
Setting permissions grants all specified roles read only access to the catalog. As a result, users have read access to all contained schema, tables, and views.
Use the following steps to assign read access to roles:
- In the Catalog-level permissions section, toggle the Read-only catalog switch to prevent write access. For catalogs pre-set to read-only, this option is already set to Read-only catalog and disabled.
- In the Role-level permissions section, expand the menu in the Roles with read access field.
- Select one or more roles from the list to grant read access to.
Click Save access controls.
Add to cluster #
You can add your catalog to a cluster later by editing a cluster. Click Skip to proceed to the catalogs page.
Use the following steps to add your catalog to an existing cluster or create a new cluster in the same cloud region:
- In the Add to cluster section, expand the menu in the Select cluster field.
- Select one or more existing clusters from the drop down menu.
- Click Create a new cluster to create a new cluster in the same region, and add it to the cluster selection menu.
Click Add to cluster to view your new catalog’s configuration.
The Pending changes to clusters dialog appears when you try to add a catalog to a running cluster.
- In the Pending changes to cluster dialog, click Return to catalogs to edit the catalog or create a new catalog.
- Click Go to clusters to confirm the addition of the catalog to the running cluster.
On the Clusters page, click the Update icon beside the running cluster, to add the catalog.
SQL support #
The connector provides read access to data and metadata in Google Sheets.
How to use the Google Sheets catalog #
Requirements for accessing the data in your Google Sheets are as follows:
- You must share the Google Sheet with the service account email address for your Google Cloud service account.
- In the query editor, your Google Sheets catalog is not displayed in the form
of schemas and tables as with other catalogs. You must use SQL commands as
shown in the following examples for a catalog named
Specify a spreadsheet:
SELECT * FROM TABLE(google_sheets.system.sheet(id => '1qWssXSqoXcJPgO4LfzOKi3AFNwhCoo61fdTz6-8TsJY'));
Specify a sheet name to return all the content in the sheet. In this example, the sheet name is Sheets2:
SELECT * FROM TABLE(google_sheets.system.sheet( id => '1qWssXSqoXcJPgO4LfzOKi3AFNwhCoo61fdTz6-8TsJY', range => 'Sheets2'));
A cell range
can be provided as an optional
range argument. The default cell range is
$1:$10000. Specify a cell range to return the desired content from the first
SELECT * FROM TABLE(google_sheets.system.sheet( id => '1qWssXSqoXcJPgO4LfzOKi3AFNwhCoo61fdTz6-8TsJY', range => 'B17:D26'));
Specify a cell range to return the desired content from a sheet subsequent to the first:
SELECT * FROM TABLE(google_sheets.system.sheet( id => '1qWssXSqoXcJPgO4LfzOKi3AFNwhCoo61fdTz6-8TsJY', range => 'Sheet2!B17:D26'));
For Google Sheets without column names, the import process assumes the top row is the header line.
Is the information on this page helpful?