Connecting to Google Sheets via Custom Application

Google Sheets Addon is a Pro Feature

Unlock Google Sheets Addon and other powerful features to grow your business.

Get WPForms Pro

Want to use our Google Sheets addon with a custom Google application instead of the WPForms Google app? Connecting to Google Sheets via custom application is sometimes the best option for developers and advanced users.

In this tutorial, we’ll show you how to use the WPForms Google Sheets addon with your own custom Google app.

Requirements:


Before getting started, you’ll first need to make sure WPForms is installed and activated on your WordPress site and that you’ve verified your license. You will also need to sign up for a Google account if you don’t already have one and install and activate the Google Sheets addon.

Note: Connecting WPForms to a custom Google application is only recommended for developers or advanced users. If you don’t need a custom application, please see our guide to using the Google Sheets addon.

Enabling Advanced Mode

To get started, open your WordPress dashboard and go to WPForms » Settings. Then click on the Integrations tab.

click-integrations-tab

Next, click on the Google Sheets integration to expand its settings.

click-google-sheets

To get started with your Google application connection, click Enable Advanced Mode.

click-enable-advanced-mode

You’ll now see additional settings where you’ll need to enter information from the Google Cloud Platform.

advanced-mode-connection-settings

To find this information, you’ll first need to log in to the Google Cloud Platform and create a custom application. However, we recommend leaving your WPForms settings open in a separate browser tab while you create your application, as you’ll need to access them later.

Adding a New Project

Once you’ve logged in to the Google Cloud Platform, click APIs & Services.

click-apis-and-app-services

On the next screen, click the projects dropdown menu.

click-select-a-project-dropdown

After that, an overlay will appear that shows your projects. Go ahead and click NEW PROJECT.

click-new-project

Next, you’ll need to add a name to the Project name field. We recommend using a name that will help you remember what you’re using the project for. However, you can use whatever name you’d like.

After adding a name, click the CREATE button.

add-project-name-and-click-create

Once you’ve created your project, click the project dropdown again and select your newly created project if it isn’t already selected by default.

click-project-dropdown

Enabling Google APIs

Now that your project is created, it’s time to enable some Google APIs. To start, click Library in the left-side menu.

click-library

This will take you to the API Library where you’ll need to locate and enable 3 different APIs: Google Drive API, Google Sheets API, and Google Picker API.

Type “Google Drive API” in the search bar to locate the Google Drive API.

search-google-drive-api

Once you’ve located the Google Drive API, click the ENABLE button.

click-enable-google-drive-ap

Next, head back to Google’s API library and type “Google Sheets API” in the search bar.

search-google-sheets-api

After locating the Google Sheets API, click the ENABLE button.

click-enable-google-sheets-api

Finally, return to Google’s API library and type “Google Picker API” in the search bar.

search-picker-api

Once you’ve located the Google Picker API, click the ENABLE button.

click-to-enable-picker-api

Selecting a User Type

Now that you’ve enabled the required APIs, click OAuth consent screen in the left-side menu.

click-oauth-consent-screen

On the next screen, you’ll need to select a User Type for your application. You can select either Internal or External, depending on who you’d like to share your app with.

For our example, we’ll select External. Once you’ve made your selection, click the CREATE button to proceed.

click-create-button-oauth-consent

Note: Be sure to check out Google’s documentation on user types to learn more about External and Internal users.

Registering Your App

After you’ve selected a User Type for your app, you’ll be redirected to a page to complete your app registration. You’ll need to complete a series of steps to register your app, which we’ll cover in the following sections.

Adding App Information

Adding information about your app is required and allows users to know who you are and how to contact you.

In the required fields, be sure to add an App name and User support email.

app-registration-name-and-support-email

Adding an App Domain

Scroll down to the App domain section and locate the Authorized domains section. From here, click the ADD DOMAIN button.

click-add-domain-button

In the Authorized domain 1 field, you’ll need to add wpforms.com as your domain.

add-wpforms-domain

Note: You must add wpforms.com as your authorized domain, or your app will fail to connect to WPForms.

Adding Developer Contact Information

Next, add your preferred email address in the Developer contact information section. Google will contact you at this email address if there are any changes to your project.

developer-email-address

Finally, click the SAVE AND CONTINUE button to proceed to the next step.

click-save-and-continue

Adding Scopes

On the next screen, click the ADD OR REMOVE SCOPES button.

click-add-or-remove-scopes

In the side modal that appears, click on the search bar labeled Enter property name or value.

enter-property-name-or-value-search-bar

Then, go ahead and search for each of the following scopes:

  • https://www.googleapis.com/auth/userinfo.email
  • https://www.googleapis.com/auth/userinfo.profile
  • https://www.googleapis.com/auth/drive.file
  • https://www.googleapis.com/auth/spreadsheets

You’ll need to enable each of the above scopes by clicking the checkbox on the left side.

click-checkbox-to-enable-scope

Once you’ve enabled the required scopes, click the UPDATE button located at the bottom of the screen.

click-update-button

You’ll then return to the Scopes screen where you can view and manage your enabled scopes. From here, go ahead and click the SAVE AND CONTINUE button to save your changes.

click-save-and-continue-scopes-screen

Adding Test Users

Google will need to complete the verification process before users can interact with your app. However, you can allow specific users to test your app before it’s verified. This step isn’t required for our setup, so we’ll go ahead and move to the next step by clicking the SAVE AND CONTINUE button.

click-save-and-continue-test-users-screen

Reviewing Your App Registration

The last step of the app registration is to review your configuration on the Summary screen. If everything looks correct and corresponds with the steps in this tutorial, click the BACK TO DASHBOARD button at the bottom of the screen.

click-back-to-dashboard-button

Publishing Your App

Now that you’ve completed the app registration, you’ll need to publish your app. You can do this directly from the Oauth consent screen by clicking on the PUBLISH APP button.

click-publish-app

After clicking the button, a modal will appear with some further steps for completing Google’s app verification process. To confirm, click CONFIRM.

click-confirm

Creating Credentials for Your Application

The next step is to create credentials for your application. To get started, click Credentials in the left-side menu.

click-credentials

Then, click CREATE CREDENTIALS at the top of the Credentials screen.

click-create-credentials

After that, click OAuth client ID.

select-oauth-client-id

Next, click the Application type dropdown and select Web application.

select-web-application

After that, be sure to enter a name for your Oauth 2.0 client in the Name field. This won’t be visible to end users, so feel free to name it whatever you’d like.

add-name-for-client-id

Next, scroll to the Authorized redirect URIs section and click ADD URI.

click-add-uri-button-1

Now you’ll need to head back to your WPForms integration settings and copy the first Callback URL by clicking the copy icon.

click-copy-icon-callback-url-1

Then, switch back to your Google application settings and paste the Callback URL into the URIs 1 field.

paste-callback-url-into-uri-1-field-1

After that, click the ADD URI button again so you can add your 2nd URI.

click-add-uri-button-2

Switch back to your WPForms settings and click the copy icon next to the 2nd Callback URL.

click-copy-icon-callback-url-2

Now you can navigate back to your Google settings and paste the 2nd Callback URL into the URIs 2 field.

add-second-callback-url

Next, click the CREATE button.

click-create-button-client-id

A modal window will then appear with your OAuth client credentials. From here, copy the Client ID by clicking the copy icon.

click-copy-icon-client-id

Then, switch over to your WPForms integration settings and paste the Client ID into the Google Client ID field.

client-id-field

Next, navigate back to your Google application settings and copy the Client secret.

click-copy-icon-client-secret

Switch over to your WPForms integration settings once more and paste the Client Secret into the Google Client Secret field.

paste-client-secret

Completing the Connection

Now that you have your Client ID and Client Secret in place, it’s time to complete the connection. To do this, click the Connect with Google button.

click-connect-to-google-sheets-button

Next, you’ll be redirected to a Google authentication page. Here you’ll need to grant WPForms access to your Google account.

Once you’ve selected a Google account, click the Continue button to grant WPForms access to your account.

checkboxes-for-google-drive-and-sheets

Now when you return to WPForms » Settings » Integrations, you should see the green Connected status along with your connection details.

google-sheets-connected-status

You can now proceed to add a Google Sheets integration to any form on your site.

That’s it! Now you know how to set up a custom Google app to use with the WPForms Google Sheets addon.

Next, would you like to learn more about what you can do with user-submitted information in WPForms? See our complete guide to form entries to learn more.