Google Drive Connector
Documentation
Version: 8
Documentation

Write data to Google Drive using SSIS (Import data)


In this section we will learn how to configure and use Google Drive Connector in the API Destination to write data to Google Drive.

Video tutorial

This video covers following and more so watch carefully. After watching this video follow the steps described in this article.

  • How to download SSIS PowerPack for Google Drive integration in SSIS
  • How to configure connection for Google Drive
  • How to write or lookup data to Google Drive
  • Features about SSIS API Destination
  • Using Google Drive Connector in SSIS

Step-by-step instructions

In upper section we learned how to read data, now in this section we will learn how to configure Google Drive in the API Source to POST data to the Google Drive.

  1. Read the data from the source, being any desired source component. In example we will use ZappySys Dummy Data Source component.

  2. From the SSIS Toolbox drag and drop API Destination (Predefined Templates) on the Data Flow Designer surface and connect source component with it, and double click to edit it.
    SSIS API Destination (Predefined Templates) - Drag and Drop

  3. Select New Connection to create a new connection:

    API Destination - Google Drive
    Read / write Google Drive data inside your app; perform many Google Drive operations without coding, just using easy to use high performance API Connector for Google Drive
    API Destination - New Connection

  4. Use a preinstalled Google Drive Connector from Popular Connector List or press Search Online radio button to download Google Drive Connector. Once downloaded simply use it in the configuration:

    Google Drive
    Google Drive Connector Selection

  5. Proceed with selecting the desired Authentication Type. Then select API Base URL (in most cases default one is the right one). Finally, fill in all the required parameters and set optional parameters if needed. You may press a link Steps to Configure which will help set certain parameters. More info is available in Authentication section.

    User accounts represent a developer, administrator, or any other person who interacts with Google APIs and services. User accounts are managed as Google Accounts, either with Google Workspace or Cloud Identity. They can also be user accounts that are managed by a third-party identity provider and federated with Workforce Identity Federation. [API reference]

    Steps how to get and use Google Drive credentials

    Follow these steps on how to create Client Credentials (User Account principle) to authenticate and access Google Drive API in SSIS package or ODBC data source:

    WARNING: If you are planning to automate processes, we recommend that you use a Service Account authentication method. In case, you still need to use User Account, then make sure you use a system/generic account (e.g. automation@my-company.com). When you use a personal account which is tied to a specific employee profile and that employee leaves the company, the token may become invalid and any automated processes using that token will start to fail.

    Step-1: Create project

    This step is optional, if you already have a project in Google Cloud and can use it. However, if you don't, proceed with these simple steps to create one:

    1. First of all, go to Google API Console.

    2. Then click Select a project button and then click NEW PROJECT button:

      Start creating a new project in Google Cloud
    3. Name your project and click CREATE button:

      Create a new project in Google Cloud
    4. Wait until the project is created:

      Wait until project is created in Google Cloud
    5. Done! Let's proceed to the next step.

    Step-2: Enable Google Drive API

    In this step we will enable Google Drive API:

    1. Select your project on the top bar:

      Select project in Google Cloud
    2. Then click the "hamburger" icon on the top left and access APIs & Services:

      Access APIs and services in Google Cloud
    3. Now let's enable several APIs by clicking ENABLE APIS AND SERVICES button:

      Enable API for project in Google Cloud
    4. In the search bar search for drive and then locate and select Google Drive API:

      Search for API in Google Cloud
    5. Enable Google Drive API:

      Enable Google Drive API
    6. Done! Let's proceed to the next step.

    Step-3: Create OAuth application

    1. First of all, click the "hamburger" icon on the top left and then hit VIEW ALL PRODUCTS:

      View all products in Google Cloud
    2. Then access Google Auth Platform to start creating an OAuth application:

      Open Google Auth Platform in Google Cloud
    3. Start by pressing GET STARTED button:

      Start creating an app in Google Cloud
    4. Next, continue by filling in App name and User support email fields:

      Fill app info in Google Cloud
    5. Choose Internal option, if it's enabled, otherwise select External:

      Choose app audience in Google Cloud
    6. Optional step if you used Internal option in the previous step. Nevertheless, if you had to use External option, then click ADD USERS to add a user:

      Add test user in Google Cloud app
    7. Then add your contact Email address:

      Enter app contact info in Google Cloud
    8. Finally, check the checkbox and click CREATE button:

      Create app in Google Cloud
    9. Done! Let's create Client Credentials in the next step.

    Step-4: Create Client Credentials

    1. In Google Auth Platform, select Clients menu item and click CREATE CLIENT button:

      Start creating app client in Google Cloud
    2. Choose Desktop app as Application type and name your credentials:

      Create OAuth app client in Google Cloud
    3. Continue by opening the created credentials:

      View app client credentials in Google Cloud
    4. Finally, copy Client ID and Client secret for the later step:

      Use client ID and secret to read Google REST API data
    5. Done! We have all the data needed for authentication, let's proceed to the last step!

    Step-5: Configure connection

    1. Now go to SSIS package or ODBC data source and use previously copied values in User Account authentication configuration:

      • In the ClientId field paste the Client ID value.
      • In the ClientSecret field paste the Client secret value.
    2. Press Generate Token button to generate Access and Refresh Tokens.

    3. Finally, click Test Connection to confirm the connection is working.

    4. Done! Now you are ready to use Google Drive Connector!

    Fill in all required parameters and set optional parameters if needed:

    GoogleDriveDSN
    Google Drive
    User Account [OAuth]
    https://www.googleapis.com/
    Required Parameters
    UseCustomApp Fill-in the parameter...
    Optional Parameters
    ClientId
    ClientSecret
    Scope https://www.googleapis.com/auth/drive
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 403|429
    RetryCountMax 5
    RetryMultiplyWaitTime True
    Redirect URL (Only for Web App)
    ODBC DSN Oauth Connection Configuration

    Service accounts are accounts that do not represent a human user. They provide a way to manage authentication and authorization when a human is not directly involved, such as when an application needs to access Google Cloud resources. Service accounts are managed by IAM. [API reference]

    Steps how to get and use Google Drive credentials

    Follow these steps on how to create Service Account to authenticate and access Google Drive API in SSIS package or ODBC data source:

    Step-1: Create project

    This step is optional, if you already have a project in Google Cloud and can use it. However, if you don't, proceed with these simple steps to create one:

    1. First of all, go to Google API Console.

    2. Then click Select a project button and then click NEW PROJECT button:

      Start creating a new project in Google Cloud
    3. Name your project and click CREATE button:

      Create a new project in Google Cloud
    4. Wait until the project is created:

      Wait until project is created in Google Cloud
    5. Done! Let's proceed to the next step.

    Step-2: Enable Google Drive API

    In this step we will enable Google Drive API:

    1. Select your project on the top bar:

      Select project in Google Cloud
    2. Then click the "hamburger" icon on the top left and access APIs & Services:

      Access APIs and services in Google Cloud
    3. Now let's enable several APIs by clicking ENABLE APIS AND SERVICES button:

      Enable API for project in Google Cloud
    4. In the search bar search for drive and then locate and select Google Drive API:

      Search for API in Google Cloud
    5. Enable Google Drive API:

      Enable Google Drive API
    6. Done! Let's proceed to the next step.

    Step-3: Create Service Account

    Use the steps below to create a Service Account in Google Cloud:

    1. First of all, go to IAM & Admin in Google Cloud console:

      Access IAM & Admin in Google Cloud
    2. Once you do that, click Service Accounts on the left side and click CREATE SERVICE ACCOUNT button:

      Start creating service account in Google Cloud
    3. Then name your service account and click CREATE AND CONTINUE button:

      Create service account in Google Cloud
    4. Continue by clicking Select a role dropdown and start granting service account Project Viewer roles:

      Start granting service account project roles in Google Cloud
    5. Find Project group and select Viewer role:

      Grant service account project viewer role
    6. Finish adding roles by clicking CONTINUE button:

      Finish granting service account project roles in Google Cloud
      You can always add or modify permissions later in IAM & Admin.
    7. Finally, in the last step, just click button DONE:

      Finish configuring service account in Google Cloud
    8. Done! We are ready to add a Key to this service account in the next step.

    Step-4: Add Key to Service Account

    We are ready to add a Key (P12 certificate) to the created Service Account:

    1. In Service Accounts open newly created service account:

      Open service account in Google Cloud
    2. Next, copy email address of your service account for the later step:

      Copy service account email address in Google Cloud
    3. Continue by selecting KEYS tab, then press ADD KEY dropdown, and click Create new key menu item:

      Start creating key for service account in Google Cloud
    4. Finally, select P12 option and hit CREATE button:

      Create P12 key for service account in Google Cloud
    5. P12 certificate downloads into your machine. We have all the data needed for authentication, let's proceed to the last step!

    Step-5: Share Google Drive files and folders with Service Account

    Now it's time to grant Google Drive read/write permissions to the created service account:

    1. Login to https://drive.google.com with Google account credentials whose files/folders you want to share with the service account.
    2. Select the file or folder, right-click on it, click Share menu item, and then hit Share subitem:

      Share Google Drive file or folder with service account
    3. Share it with your service account:

      Share Google Drive folder with service account
    4. Grant it appropriate permissions, e.g. Viewer or Editor (for reading or writing):

      Grant service account Google Drive file permissions
    5. That's it! Let's proceed to the configuration!

    Step-6: Configure connection

    1. Now go to SSIS package or ODBC data source and configure these fields in Service Account authentication configuration:

      • In the Service Account Email field paste the service account Email address value you copied in the previous step.
      • In the Service Account Private Key Path (i.e. *.p12) field use downloaded certificate's file path.
    2. Done! Now you are ready to use Google Drive Connector!

    Fill in all required parameters and set optional parameters if needed:

    GoogleDriveDSN
    Google Drive
    Service Account [OAuth]
    https://www.googleapis.com/
    Required Parameters
    Service Account Email Fill-in the parameter...
    Service Account Private Key Path (i.e. *.p12) Fill-in the parameter...
    Optional Parameters
    Scope https://www.googleapis.com/auth/drive
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 403|429
    RetryCountMax 5
    RetryMultiplyWaitTime True
    Impersonate As (Google account email address)
    ODBC DSN Oauth Connection Configuration

  6. Select the desired endpoint, change/pass the properties values, and go to the Mappings tab to map the columns.

    API Destination - Google Drive
    Read / write Google Drive data inside your app; perform many Google Drive operations without coding, just using easy to use high performance API Connector for Google Drive
    API Destination - Select Endpoint

  7. Finally, map the desired columns:

    API Destination - Google Drive
    Read / write Google Drive data inside your app; perform many Google Drive operations without coding, just using easy to use high performance API Connector for Google Drive
    API Destination - Columns Mapping

  8. That's it; we successfully configured the POST API Call. In a few clicks we configured the Google Drive API call using ZappySys Google Drive Connector

    Execute Package - Reading data from API Source and load into target