Export business glossaries to a Google Sheet

This document explains how to use the business glossary export utility to extract glossaries, categories, and terms from Knowledge Catalog (formerly Dataplex Universal Catalog) into a Google Sheet for bulk management and reporting.

The glossary_export utility retrieves metadata from your Knowledge Catalog business glossary and populates a Google Sheet with a structured schema, including descriptions, data stewards, and labels.

Before you begin

Before you export glossaries, complete the following prerequisites.

To run the export utility, you must set up a service account with the necessary permissions to access the Google Sheets API and impersonate your user credentials:

  1. Identify or create a service account.

    Select an existing service account or create a new one in the project where you run the import utility. For more information, see Create service accounts . Note the service account email (for example, SERVICE_ACCOUNT_NAME @ PROJECT_ID .iam.gserviceaccount.com ).

  2. Configure service account impersonation.

    To run the export utility script locally, your user account must have permission to impersonate the service account. Grant your user account the Service Account Token Creatorrole ( roles/iam.serviceAccountTokenCreator ) on the service account.

    For more information, see Manage access to service accounts .

  3. Grant the service account Editor access to the Google Sheet.

    Open the Google Sheet you want to use for the import process, click Share, and add the service account email as an Editor . This permission enables the service account to read from or write data to your sheet.

Required roles

To ensure that the service account has the necessary permissions to export glossaries to a Google Sheet, ask your administrator to grant the following IAM roles to the service account:

For more information about granting roles, see Manage access to projects, folders, and organizations .

Your administrator might also be able to give the service account the required permissions through custom roles or other predefined roles .

Enable APIs

To export glossaries, enable the following APIs in your project:

Roles required to enable APIs

To enable APIs, you need the Service Usage Admin IAM role ( roles/serviceusage.serviceUsageAdmin ), which contains the serviceusage.services.enable permission. Learn how to grant roles .

Enable the APIs

Set up the git repository

Clone the dataplex-labs repository:

git  
clone  
https://github.com/GoogleCloudPlatform/dataplex-labs.git cd 
  
dataplex-labs/dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/dataplex-glossary/export

Install dependencies

Install the required Python dependencies:

  pip3 
 install 
 - 
 r 
 requirements 
 . 
 txt 
 

If you encounter any issues with the package installation, set up a new Python development environment .

Initialize the Google Cloud CLI and authenticate using Application Default Credentials (ADC) with service account impersonation:

 # Set your service account email address 
 SA_EMAIL 
 = 
 " SERVICE_ACCOUNT_EMAIL 
" 
 # Authenticate ADC using service account impersonation and required scopes 
gcloud  
auth  
application-default  
login  
 \ 
  
--impersonate-service-account = 
 " 
 ${ 
 SA_EMAIL 
 } 
 " 
  
 \ 
  
--scopes = 
 "https://www.googleapis.com/auth/spreadsheets" 

Replace SERVICE_ACCOUNT_EMAIL with the service account email ID. For example:

SERVICE_ACCOUNT_NAME @ PROJECT_ID .iam.gserviceaccount.com

Set up the target Google Sheet for export

Create an empty Google Sheet or use an existing one. The export script writes to the first sheet. Ensure that you have granted the service account Editor access to the Google Sheet.

Export glossary to the Google Sheet

Run the glossary-export.py script. The utility prompts you for the target Google Sheet and the specific glossary name that you want to export, during execution:

  python3 
 glossary 
 - 
 export 
 . 
 py 
 

You can review the execution logs in the logs/ directory in your local execution path. These logs help you audit the transfer process and identify skipped entries or formatting warnings.

Verify the exported glossary data

The export script populates the Google Sheet with the following columns. Verify the exported data.

Field Description
id A unique identifier for the term or category within the glossary.
parent The ID of the parent category.
display_name The display name of the term or category.
description A brief description of the term or category.
overview A rich text description of the term or category (supports HTML tags).
type The row type: TERM or CATEGORY .
contact1_email Email address of the primary data steward for the term or category.
contact1_name Name of the primary data steward for the term or category.
contact2_email Email address of the secondary data steward for the term or category.
contact2_name Name of the secondary data steward for the term or category.
label1_key Key for the first assigned label.
label1_value Value for the first assigned label.
label2_key Key for the second assigned label.
label2_value Value for the second assigned label.

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: