The extension supports several authentication methods via DuckDB's CREATE SECRET command. Choose the method that fits your workflow:
- Interactive (Browser-based): The default method for interactive sessions.
- Access Token: Use a specific Google API access token.
- Service Account (JSON File): Use a non-expiring JSON key file. Ideal for non-interactive data pipelines.
- Service Account (Direct): Pass the service account email and private key directly in the secret definition.
-- Authenticate with Google Account in the browser (default)
CREATE SECRET (TYPE gsheet);
-- Create a secret with your Google API access token
CREATE SECRET (
TYPE gsheet,
PROVIDER access_token,
TOKEN '<your_token>'
);
-- Create a non-expiring JSON secret with your Google API private key
CREATE SECRET (
TYPE gsheet,
PROVIDER key_file,
FILEPATH '<path_to_JSON_file_with_private_key>'
);
-- Pass the secret directly
CREATE SECRET (
TYPE gsheet,
PROVIDER key_file,
EMAIL '<service_account_email>',
SECRET '<private_key>'
);