Google Sheets ODBC Driver

Read / write Google Sheets data inside your app, perform many Google Sheets operations without coding using easy to use high performance API Connector for Google Sheets

In this article you will learn how to quickly and efficiently integrate Google Sheets data in ODBC without coding. We will use high-performance Google Sheets Connector to easily connect to Google Sheets and then access the data inside ODBC.

Let's follow the steps below to see how we can accomplish that!

Download Documentation

Create ODBC Data Source (DSN) based on ZappySys API Driver

Step-by-step instructions

To get data from Google Sheets using ODBC we first need to create a DSN (Data Source) which will access data from Google Sheets. We will later be able to read data using ODBC. Perform these steps:

  1. Download and install ODBC PowerPack.

  2. Open ODBC Data Sources (x64):

    Open ODBC Data Source
  3. Create a User data source (User DSN) based on ZappySys API Driver

    ZappySys API Driver
    Create new User DSN for ZappySys API Driver
    • Create and use User DSN if the client application is run under a User Account. This is an ideal option in design-time, when developing a solution, e.g. in Visual Studio 2019. Use it for both type of applications - 64-bit and 32-bit.
    • Create and use System DSN if the client application is launched under a System Account, e.g. as a Windows Service. Usually, this is an ideal option to use in a production environment. Use ODBC Data Source Administrator (32-bit), instead of 64-bit version, if Windows Service is a 32-bit application.
  4. When the Configuration window appears give your data source a name if you haven't done that already, then select "Google Sheets" from the list of Popular Connectors. If "Google Sheets" is not present in the list, then click "Search Online" and download it. Then set the path to the location where you downloaded it. Finally, click Continue >> to proceed with configuring the DSN:

    GoogleSheetsDSN
    Google Sheets
    ODBC DSN Template Selection
  5. Now it's time to configure the Connection Manager. Select Authentication Type, e.g. Token Authentication. Then select API Base URL (in most cases, the default one is the right one). More info is available in the 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 Sheets credentials

    Follow these steps on how to create Client Credentials (User Account principle) to authenticate and access Google Sheets 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 Cloud APIs

    In this step we will enable Google Sheets API and 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 sheets and then locate and select Google Sheets API:

      Search for API in Google Cloud
    5. Then enable Google Sheets API:

      Enable Google Sheets API
    6. Again, repeat the step and enable Google Drive API as well:

      Enable Google Drive API
    7. 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. Open your Google Sheets spreadsheet in the browser, e.g.: https://docs.google.com/spreadsheets/d/1QM6WmGloHeGCliCqV3nEj8P-R1RbS59t5xJutN99rU/edit.

    4. Extract the spreadsheet Id from the URL and copy it to the clipboard, e.g. 1QM6WmGloHeGCliCqV3nEj8P-R1RbS59t5xJutN99rU.

    5. Go back to authentication configuration window and paste it into Default SpreadsheetId field.

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

    7. Done! Now you are ready to use Google Sheets Connector!

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

    GoogleSheetsDSN
    Google Sheets
    User Account [OAuth]
    https://sheets.googleapis.com/v4/spreadsheets
    Required Parameters
    UseCustomApp Fill-in the parameter...
    Scope Fill-in the parameter...
    Default SpreadSheetId Fill-in the parameter...
    Optional Parameters
    ClientId
    ClientSecret
    Default Tab Name (i.e. Sheet1)
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 403|429
    RetryCountMax 5
    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 Sheets credentials

    Follow these steps on how to create Service Account to authenticate and access Google Sheets 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 Cloud APIs

    In this step we will enable Google Sheets API and 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 sheets and then locate and select Google Sheets API:

      Search for API in Google Cloud
    5. Then enable Google Sheets API:

      Enable Google Sheets API
    6. Again, repeat the step and enable Google Drive API as well:

      Enable Google Drive API
    7. 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 (JSON or P12 key file) 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 JSON (Engine v19+) or P12 option and hit CREATE button:

      Create JSON or P12 key for service account in Google Cloud
    5. Key file downloads into your machine. 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 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. *.json OR *.p12) field use downloaded certificate's file path.
    2. Press Generate Token button to generate Access and Refresh Tokens.

    3. Open your Google Sheets spreadsheet in the browser, e.g.: https://docs.google.com/spreadsheets/d/1QM6WmGloHeGCliCqV3nEj8P-R1RbS59t5xJutN99rU/edit.

    4. Extract the spreadsheet Id from the URL and copy it to the clipboard, e.g. 1QM6WmGloHeGCliCqV3nEj8P-R1RbS59t5xJutN99rU.

    5. Go back to authentication configuration window and paste it into Default SpreadsheetId field.

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

    7. Done! Now you are ready to use Google Sheets Connector!

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

    GoogleSheetsDSN
    Google Sheets
    Service Account [OAuth]
    https://sheets.googleapis.com/v4/spreadsheets
    Required Parameters
    Service Account Email Fill-in the parameter...
    Service Account Private Key Path (i.e. *.json OR *.p12) Fill-in the parameter...
    Default SpreadSheetId Fill-in the parameter...
    Optional Parameters
    Scope https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/spreadsheets
    Default Tab Name (i.e. Sheet1)
    RetryMode RetryWhenStatusCodeMatch
    RetryStatusCodeList 403|429
    RetryCountMax 5
    Impersonate As (Enter Email Id)
    ODBC DSN Oauth Connection Configuration

  6. Once the data source connection has been configured, it's time to configure the SQL query. Select the Preview tab and then click Query Builder button to configure the SQL query:

    ZappySys API Driver - Google Sheets
    Read / write Google Sheets data inside your app, perform many Google Sheets operations without coding using easy to use high performance API Connector for Google Sheets
    GoogleSheetsDSN
    Open Query Builder in API ODBC Driver to read and write data to REST API
  7. Start by selecting the Table or Endpoint you are interested in and then configure the parameters. This will generate a query that we will use in ODBC to retrieve data from Google Sheets. Hit OK button to use this query in the next step.

    SELECT * FROM [Sheet1]
    Configure table/endpoint parameters in ODBC data source based on API Driver
    Some parameters configured in this window will be passed to the Google Sheets API, e.g. filtering parameters. It means that filtering will be done on the server side (instead of the client side), enabling you to get only the meaningful data much faster.
  8. Now hit Preview Data button to preview the data using the generated SQL query. If you are satisfied with the result, use this query in ODBC:

    ZappySys API Driver - Google Sheets
    Read / write Google Sheets data inside your app, perform many Google Sheets operations without coding using easy to use high performance API Connector for Google Sheets
    GoogleSheetsDSN
    SELECT * FROM [Sheet1]
    API ODBC Driver-based data source data preview
    You can also access data quickly from the tables dropdown by selecting <Select table>.
    A WHERE clause, LIMIT keyword will be performed on the client side, meaning that the whole result set will be retrieved from the Google Sheets API first, and only then the filtering will be applied to the data. If possible, it is recommended to use parameters in Query Builder to filter the data on the server side (in Google Sheets servers).
  9. Click OK to finish creating the data source.

Video Tutorial

Actions supported by Google Sheets Connector

Learn how to perform common Google Sheets actions directly in ODBC with these how-to guides:

Conclusion

In this article we showed you how to connect to Google Sheets in ODBC and integrate data without any coding, saving you time and effort. It's worth noting that ZappySys API Driver allows you to connect not only to Google Sheets, but to any Java application that supports JDBC (just use a different JDBC driver and configure it appropriately).

We encourage you to download Google Sheets Connector for ODBC and see how easy it is to use it for yourself or your team.

If you have any questions, feel free to contact ZappySys support team. You can also open a live chat immediately by clicking on the chat icon below.

Download Google Sheets Connector for ODBC Documentation

More integrations

Other connectors for ODBC

All
Big Data & NoSQL
Database
CRM & ERP
Marketing
Collaboration
Cloud Storage
Reporting
Commerce
API & Files

Other application integration scenarios for Google Sheets

All
Data Integration
Database
BI & Reporting
Productivity
Programming Languages
Automation & Scripting
ODBC applications

  • How to connect Google Sheets in ODBC?

  • How to get Google Sheets data in ODBC?

  • How to read Google Sheets data in ODBC?

  • How to load Google Sheets data in ODBC?

  • How to import Google Sheets data in ODBC?

  • How to pull Google Sheets data in ODBC?

  • How to push data to Google Sheets in ODBC?

  • How to write data to Google Sheets in ODBC?

  • How to POST data to Google Sheets in ODBC?

  • Call Google Sheets API in ODBC

  • Consume Google Sheets API in ODBC

  • Google Sheets ODBC Automate

  • Google Sheets ODBC Integration

  • Integration Google Sheets in ODBC

  • Consume real-time Google Sheets data in ODBC

  • Consume real-time Google Sheets API data in ODBC

  • Google Sheets ODBC Driver | ODBC Driver for Google Sheets | ODBC Google Sheets Driver | SSIS Google Sheets Source | SSIS Google Sheets Destination

  • Connect Google Sheets in ODBC

  • Load Google Sheets in ODBC

  • Load Google Sheets data in ODBC

  • Read Google Sheets data in ODBC

  • Google Sheets API Call in ODBC