Google Sheets

Author: Nasir Ahmed 140 views

Overview

The Advanced Form Integration plugin can integrate Google Sheets so that when a sender form is submitted, or a WooCommerce order is placed, it will create a new row on a selected sheet with supplied data.

Authentication

At first, we need to create a Google API project that will grant access to the plugin Advanced Form Integration. Please follow the instructions below:

Go to Google Developer Console and create a New Project.

Put a suitable project name and click on the CREATE button.

Select the project from the dropdown.

Go to Top Left Menu > API & Services > Library 

Both Google Drive API and Google Sheets API need to be enabled.

Google Drive API is needed only to read the available Spreadsheets list. 

Google Sheets API is needed to read write data inside a spreadsheet. 

Go to the OAuth consent screen menu. Select External and hit the CREATE button.

  • Put an App name as you want and select User support email.

  • In the Authorized domains section, click on ADD DOMAIN button, and enter yourdomain.xxx. This is the domain of your website where the plugin is installed.

  • Put your email address in the Developer contact information input box.

  • Click on SAVE AND CONTINUE.

On the Scopes page, click on ADD OR REMOVE SCOPES button. Search and select Google Drive API. Mark the read-only access checkbox. 

Again search and select Google Sheets API. Mark the spreadsheet access checkbox. Then click the UPDATE button.

Make sure that both Google Drive’s readonly and Google Sheets spreadsheets scopes are added. Click on SAVE AND CONTINUE.

Nothing need to be done on Test users page. Click on SAVE AND CONTINUE.

You are now on the Summary page. Click on BACK TO DASHBOARD.

Click on PUBLISH APP and then CONFIRM.

Go to Credentials menu, click on +CREATE CREDENTIALS. Select OAuth Client ID.

Select Web Application as Application Type. Put any name. In the Authorized redirect URIs section click on ADD URI. Insert URI like https://xxxxxx.xxx/wp-json/advancedformintegration/googlesheets, here xxxxxx.xxx is your website domain. Click on CREATE.

A new pop-up window will appear that contains the Client ID and Client Secret. Copy both the plugin settings page. Click on Save & Authorize and finish the authorization process.

Here is a video tutorial that can help you to understand:

Creating A New Integration

Here below a brief description on how easily you can start an integration.

  1. At first, make sure that the authorisation is done and the status is showing connected in the settings page.

  2. Click on Add New menu and setup the trigger platform.

  3. A default title will be auto-filled in the Integration Title input box. You can change it to something relevant.

  4. In Trigger > Form/Data Provider select Contact Form 7.

  5. The Form/Task Name dropdown will show a list of form names. Select the form you want to connect.
  6. In Action > Platform dropdown, select the platform name to where you want to send the data. If you don't see the platform, go to plugin settings page and activate it. Complete the fields mapping. It can be different for different platforms. Please check out the documentation page for Receiver Platforms.

  7. Conditional Logic can be applied if required.

  8. Click on Save Integration button and you are done.

Now start integration

Platform: Select Google Sheets.

Task: Select Add New Row. New section will appear were you can select the spreadsheet, worksheet name and map fields.

Spreadsheet: Select the correct sheet name.

Worksheet: You may have several tabs in the sheet. All names will be automatically populated in the dropdown. Select the correct one.

Map Fields: After selecting the worksheet/tab all table column headers will appear and you will be able to map correct fields. Please note that table titles must be in first row of the sheet. Otherwise AFI plugin can’t recognize the titles.

google sheets - table title

Common Problems and Solutions

Go to Google API projects, and select the project from the upper dropdown menu. Then go to the OAuth consent screen menu. Check Publishing status. If it is on testing, click the button PUBLISH APP.

Two types of accesses are needed for full operation. Google Drive API access is needed to read and populate the spreadsheet list. And Google Sheets API access for getting the details of a sheet, like tabs list. So check your Google API project library that both Google Drive API & Google Sheets API were enabled and scopes added.

Please go to the Google App Permissions page and look for a previous authorization for this app and click on REMOVE ACCESS. Then try authorizing again.

Go to WordPress admin > Settings > Permalinks . Now select Post name and save the changes. Try authorizing again.

The plugin itself doesn’t impose any limit. However, Google Sheets API has limits like a maximum of 500 requests per 100 seconds. Please check the Google Sheets Usage Limit page for more details.

 
On this page