July 18, 2023

Set up a WordPress Google Sheets Integration with JetEngine & REST API

Play Video

With a WordPress Google Sheets connection, you can enter something in your Google Sheets and it will automatically show on your website. Moxet Khan will show you how with the help of JetEngine and the REST API functionality. It’s like connecting two different worlds, each with its own language, and making them understand each other.


Understanding the Basics

Imagine REST API as a translator. JetEngine, on the other hand, is like the engine of a car. It powers up WordPress and makes this integration possible. Setting up a Google Sheets to WordPress connection helps Google Sheets and WordPress to communicate with each other.


Setting up Google Sheets

First things first, let’s set up a Google Sheet. It’s as easy as making a shopping list. You just need to create a new sheet and add some fields. For our example, let’s go with ‘name’, ’email’, and ‘designation’. Each of these fields will hold specific information.


Implementing the Google App Script

Now, let’s bring in the Google App Script. Think of it as a magic wand that transforms your Google Sheet data into a language (JSON format) that WordPress can understand.

Here’s how you do it:

  1. Copy the script code below:
    function getSheetDataAsJSON() {
      var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
      var range = sheet.getDataRange();
      var values = range.getValues();
      var headers = values[0];
      var jsonData = [];
    
      for (var i = 1; i < values.length; i++) {
        var row = values[i];
        var rowObj = {};
    
        for (var j = 0; j < headers.length; j++) {
          rowObj[headers[j]] = row[j];
        }
    
        jsonData.push(rowObj);
      }
    
      return JSON.stringify(jsonData);
    }
    
    function doGet() {
      return ContentService.createTextOutput(getSheetDataAsJSON())
        .setMimeType(ContentService.MimeType.JSON);
    }

    Source: GitHub

  2. Go to your Google Sheet and click on ‘Extension’ then ‘App Scripts’.
  3. Remove everything and paste the copied code.
  4. Click on ‘Deploy’.

Voila! Your Google Sheet data is now in JSON format.


Setting up JetEngine REST API Endpoint

  1. Go to JetEngine in your WordPress dashboard.
  2. Click on ‘REST API endpoint’.
  3. Create a new endpoint and paste the URL from the Google App Script.
  4. Click ‘Send a request’ and then ‘Save’.

Creating a Query Builder in WordPress

  1. Go back to JetEngine and click on ‘Query Builder’.
  2. Click ‘Add new’.
  3. Choose ‘REST API’ for the query type.
  4. Enable ‘Our Result’ and choose ‘Sheet API’ for the endpoint.
  5. Click ‘Add Query’.

Creating a Table Builder in WordPress

  1. Go to ‘Table Builder’ in JetEngine.
  2. Click ‘Add new’.
  3. Choose ‘REST API Google Sheet’ for the query.
  4. Click ‘Fetch Data’.
  5. Create columns for ‘name’, ’email’, and ‘designation’.
  6. Click ‘Create Table’.

Displaying the Data on a WordPress Page

  1. Create a new page in WordPress.
  2. Add a dynamic table to the page.
  3. Choose ‘Google Sheet API Table’.
  4. Click ‘Update’.

Updating the Data in Real-Time

One of the coolest things about this integration is that any changes you make in Google Sheets will be reflected in real-time on your WordPress page. It’s like having a live broadcast from Google Sheets to your WordPress page.


Adding Images to the Data

  1. Add an ‘image’ field in Google Sheets.
  2. Add images to the field.
  3. Refresh the data in the Table Builder in WordPress.
  4. Add a new column for the images in the table. In this example, the following HTML code to style it:
    <img style="width: 100px;" src="%s" />
  5. Click ‘Update’.

Real-World Applications

Integrating Google Sheets with WordPress using JetEngine REST API is like having a superpower. It opens up a world of possibilities. Here are a few real-world applications:

  • Content Management
    Bloggers can use Google Sheets to plan and manage their content. They can update their post titles, descriptions, and publication dates in Google Sheets, and it will automatically update on their WordPress site.
  • Product Catalog
    E-commerce businesses can manage their product catalog in Google Sheets. They can easily update product details, prices, and images, and it will reflect on their WordPress site in real time.
  • Team Directory
    Companies can create a dynamic team directory on their WordPress site. They can manage their team members’ details in Google Sheets, and it will automatically update their site.
  • Event Calendar
    Event organizers can manage their event calendar in Google Sheets. They can update event details, dates, and images, and it will automatically update on their WordPress site.

Common Google Sheet WordPress Troubleshooting Tips

Just like learning to ride a bike, you might encounter a few bumps along the way when setting up your WordPress Google Sheets Integration. But don’t worry, here are some common issues and how to navigate them:

  • Google Sheets Data Not Displaying on WordPress Page
    Double-check your Google App Script and make sure it’s correctly implemented. Also, ensure that the URL from the script is correctly pasted in the JetEngine endpoint.
  • Images Not Displaying in WordPress
    Make sure the image URLs in Google Sheets end with an image extension like .jpg or .png. Also, ensure that the image URLs are correctly fetched in the Table Builder in WordPress.
  • Changes in Google Sheets Not Reflecting on WordPress Page
    Refresh the data in the Table Builder in WordPress. If the issue persists, check your Google App Script and JetEngine endpoint.

WordPress Google Sheets Integration Conclusion

Congratulations! You’ve just built a bridge between Google Sheets and WordPress using JetEngine & REST API. It’s like you’ve successfully hosted a party where two different groups of friends finally meet and hit it off. Now, you can sit back, relax, and watch as data seamlessly flows between your Google Sheets and WordPress site. Remember, the digital world is your playground. So, don’t be afraid to experiment and try new things. Who knows what exciting integrations you might come up with next?

Required Resources

JetEngine Logo
Payment required
Elementor Logo
Free Options
Credit to Moxet Khan
Moxet Khan is a YouTuber who specializes in solving complex WordPress scenarios with simple logic. He provides tutorials and walkthroughs on how to resolve various WordPress issues and challenges, such as fixing common errors, troubleshooting plugin conflicts, optimizing website performance, and more.
Visit
Set up a WordPress Google Sheets Integration with JetEngine & REST API
Welcome back!
Enter your Helwp credentials to sign in.

No Account yet? Sign Up

My Account
Menu
Give Feedback
Describe your feedback *
Rate Helwp
Share
Facebook
Twitter
LinkedIn
Reddit
Email
WhatsApp
Telegram
Pocket
Report
Problem *
Describe the problem
Want us to reply?
Your E-Mail
Affiliate Disclosure

At Helwp, we’re committed to transparency and honesty. Therefore, we want to inform you that some of the links on our website are affiliate links. This means that, at no additional cost to you, we may earn a small commission if you click through and make a purchase.

We only promote products or services that we genuinely believe in. These affiliate commissions help us to maintain the website and continue to provide you with free, high-quality WordPress content.

If you are interested in how you can support us even further, check out our support page.