Google Drive connection
Updated
A Google Drive connection authenticates Data Integration to Google Drive so a Data Flow can read files from it. You can authenticate with a Google account using OAuth or with a service account. You create the connection once, then select it as a source in one or more Data Flows.
Prerequisites
This page covers two authentication methods: OAuth and service account. OAuth is the default and requires a user to sign in interactively. Service account is for automated pipelines. See Service account authentication.
- A Google account with access to the Drive content you want to pull.
- Permission to grant Data Integration access to your Google Drive when prompted.
- If the content lives in a Shared Drive, the connected account must be a member of that Shared Drive, or the files must be shared with it.
Creating the connection
- In Data Integration, go to Connections.
- Click Create New Connection.
- Search for and select Google Drive.
- In the Connection Name field, enter a name that identifies this connection.
- In Authentication Type, make sure Oauth2 is selected. It's the default.
- Click Sign in with Google.
- In the Google sign-in window, choose the account you want to connect with, and approve the requested access. The window closes when you grant consent.
- Click Test Connection. Data Integration refreshes the access token and reads a single file listing to confirm that the account is valid and that Drive access was granted.
- Click Save. The connection is now available to select as a source in a Data Flow.
note
- The connection uses Google OAuth 2.0, so no credentials are entered into Data Integration. If the connected Google account is later deactivated, the connection stops working and must be re-created by another user. This applies to OAuth connections only. Service account connections aren't affected.
- If Test Connection fails immediately after connecting, the most common cause is that Drive access wasn't approved on the consent screen. Repeat step 6, and confirm that you accept the Drive permission.
Service account authentication
A service account connection lets automated pipelines connect to Google Drive without requiring a user to sign in interactively. Instead of OAuth, you provide a JSON key file downloaded from your Google Cloud project.
Prerequisites for a service account
- A Google Cloud project with the Drive API enabled.
- A service account in that project with a JSON key file downloaded.
- If you access a Google Workspace domain on behalf of users, configure domain-wide delegation in your Google Admin console and grant the scope
https://www.googleapis.com/auth/drive.readonlyto the service account's client ID.
Creating a service account connection
- In Data Integration, go to Connections.
- Click Create New Connection.
- Search for and select Google Drive.
- In the Connection Name field, enter a name that identifies this connection.
- In Authentication Type, select Service Account.
- In Add Key File, drag and drop the JSON key file you downloaded from your Google Cloud project into the field, or click Browse for a file and select it.
- Click Test Connection to confirm that the key is valid and that Drive access is granted.
- Click Save.
note
- A service account connection doesn't depend on a personal Google account. If the person who created the key leaves your organization, the connection continues to work as long as the key remains valid.
- Without domain-wide delegation, the service account can only access files and folders that are explicitly shared with its email address. Share the relevant folders or Shared Drives with the service account email before you run a Data Flow.