Connecting 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 in Google Sheets

To pull data from the WooCommerce API to Google Sheets, first install and open the Apipheny Google Sheets add-on.

Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs, save API requests, schedule API requests, and more. 

1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://apipheny.io/install

Install Apipheny in the Google Workspace Marketplace

2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In the add-ons menu, you should see Apipheny.

Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.

Opening the Apipheny add-on in Google Sheets

Step 2.) Generate 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 URL

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: https://woocommerce.github.io/woocommerce-rest-api-docs/

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:

https://example.com/wp-json/wc/v3/customers?consumer_key=<consumer_key>&consumer_secret=<consumer_secret>

If you use this API URL, do not forget to replace <consumer_key> and <consumer_secret> with their actual values from the previous step.

Also, replace example.com 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: https://example.com/wp-json/wc/v3/

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

Step 4.) Add your WooCommerce API URL into the Apipheny Add-on

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:

https://example.com/wp-json/wc/v3/orders?consumer_key=<consumer_key>&consumer_secret=<consumer_secret>

Don’t forget to replace example.com with your domain name and <consumer_key> and <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, such as:

  • Saving and scheduling your API request
  • Use the custom =APIPHENY() function to call the API request inside your spreadsheet
  • Or try creating an API request by referencing the value of a cell in the API URL with three curly braces eg. {{{Sheet1!A1}}}

You could also connect to other API data sources and create custom blends of data.

Related Posts