Skip to main content

Templates in Google Sheets

The Databricks Connector for Google Sheets lets you save a reusable set of imports as a template in Unity Catalog. Create templates from your saved imports, organize them into groups that you share with specific users, and import a template's queries into any sheet. A template stores only the query definitions, not the imported data, so each person who uses it runs the queries with their own Unity Catalog permissions.

This page explains how to set up, create, and manage templates. To import data from a template, see Choose an import method.

Set up templates​

A workspace admin or a user with the CREATE CATALOG privilege must set up templates in the Databricks Connector for Google Sheets:

  1. In the connector sidebar, click the Saved imports tab, then click the File document icon. Templates icon.
  2. Enter a name for your first template group. Template groups organize related templates.
  3. Choose who can use templates in the group:
    • Share with all account users: Everyone in the account.
    • Share with specific users: Enter one or more email addresses.
  4. Click Setup Templates. This creates a spreadsheet_templates catalog and a gsheet_templates schema in your workspace's metastore, and grants SELECT on the new template group to the users you chose.
important

The connector grants only SELECT on the template group. For users to see and import templates, a workspace admin must also grant them USE CATALOG on the spreadsheet_templates catalog and USE SCHEMA on the gsheet_templates schema. To let users create or edit templates, also grant MODIFY on the template group. See Manage privileges in Unity Catalog.

Create a template group​

After templates are set up, any user with access to the templates catalog and schema can create template groups. To create or edit templates in a group, you need MODIFY on that group.

Template groups organize related templates and control who can access them. When you create a group, you choose which users can use the templates in it.

  1. In the Saved imports tab, click the File document icon. Templates icon, then click + New Group.
  2. Enter a group name using letters, numbers, and underscores.
  3. Choose who can use the group:
    • Share with all account users: Everyone in the account.
    • Share with specific users: Enter one or more email addresses.
  4. Click Create group.

Create a template​

Create a template from the imports already saved in your workbook:

  1. In the Saved imports tab, click the File document icon. Templates icon, then click + New Template.
  2. Select a template group and enter a name for the template.
  3. Select the saved imports to include.
  4. Click Create Template.

Manage templates​

In the Templates view, you can do the following:

  • Expand a template to see the imports it contains.
  • Edit a template to add or remove imports.
  • Delete a template.

Editing and deleting a template require MODIFY on the template group.

Limitations​

  • You can add imports to or remove imports from a template, but you can't edit the saved query text from within a template. Instead, delete and recreate the template.
  • You can't create templates from the Databricks UI or from Databricks saved queries.

Additional resources​