How to connect the WooCommerce API to Google Sheets

WooCommerce is a free WordPress plugin that adds e-commerce functionality to your WordPress website so you can have an online store. We can use the WooCommerce API to import data from WooCommerce into Google Sheets. In this tutorial, we’ll show you how to connect the WooCommerce REST API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Generate API Key
  3. Choose a WooCommerce API Endpoint URL
  4. Add your WooCommerce API URL into the Apipheny Add-on
  5. Run the WooCommerce API Request in Google Sheets

Step 1.) Install and open the Apipheny add-on for Google Sheets

Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.

1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace:

2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.

In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser:

Step 2.) Generate an API key

Go to your WordPress site dashboard, then click WooCommerce > Settings > Advanced > REST API.

Select Add Key. You will then be taken to the Key Details screen.

Key Details fields
Key Details fields

Add a description, then select the user you would like to generate a key for, in the dropdown list.

From Permissions, select a level of access for this API key — Read access, Write access or Read/Write access.

Finally, click the Generate API Key button and WooCommerce will create an API key for that user.

Now that keys have been generated, you should see the Consumer Key and Consumer Secret fields, a QRCode, and a Revoke API Key button.

Consumer key and Consumer secret values
Consumer key and Consumer secret values

Keep this tab opened or copy the two fields to a safe place, because you’ll need them later.

Step 3.) Choose a WooCommerce API endpoint

In this section, I’ll show you how to browse the WooCommerce API documentation to find an API URL and endpoint that retrieves the specific information you need from your WooCommerce account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the WooCommerce API documentation page:

The menu on the left contains the general Introduction and Authentication sections, followed by a list of APIs for WooCommerce, each with its own endpoints:

WooCommerce API documentation page
WooCommerce API documentation page

Clicking on an API scrolls the page to that API’s section, containing a list of associated endpoints. For instance, if you click on the Customers API, the page will scroll to the list of its 8 endpoints: Customer properties, Create a customer, Retrieve a customer, List all customers, Update a customer, Delete a customer, Batch update customer, and Retrieve customer downloads.

The Customers category
The Customers category

One of the available endpoints is List all customers. If we use the List all customers endpoint, then our whole URL will look like this:

If you use this API URL, do not forget to replace your_consumer_key and your_consumer_secret with their actual values from the previous step. Also, replace with your domain name.

The endpoint’s documentation contains its HTTP method (GET), the URI, a list of available parameters, the cURL command for making a request and an example response:

List all customers Endpoint
List all customers Endpoint

All API calls to WooCommerce should be made to the root domain:

All endpoints should be appended to this root domain. Replace with your domain name.

Step 4.) Enter your API request into Apipheny

Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import Tab open, enter these details into the add-on:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) as required by your WooCommerce API endpoint. For this example, we are using the GET method.

API URL: In Step 3, I explained how you can find the WooCommerce API endpoint that you need. Now copy the complete API URL into the Apipheny add-on, where it says API URL Path (JSON / CSV), followed by any GET parameters required for your query.

For this example, we are using the List all orders endpoint, which helps you to view all the orders. The corresponding URL for this endpoint is:

Don’t forget to replace with your domain name and your_consumer_key and your_consumer_secret with real values.

Headers: Headers aren’t required for this API, you can leave this section blank in Apipheny.

WooCommerce API request entered into Apipheny

Step 5.) Run the WooCommerce API Request in Google Sheets

Click the Run button at the bottom of the Apipheny add-on and then wait for the WooCommerce data to be imported into your Google Sheet.

After successfully calling the WooCommerce API, try querying a different endpoint, or try using one of the more advance features in the Apipheny add-on.

Popular API Tutorials

API Knowledge

What is an API?

What is an API URL?

What are parameters?

What is an endpoint?

What is an API key/token?

What is basic authentication?

What are headers?

What is a GET request?

What is a POST request?

Import JSON to Google Sheets

SEO by SearchCyrus