Import WooCommerce Data to Google Sheets
In this guide, we’ll walk through how to pull data from the WooCommerce API directly into Google Sheets, using the API Connector add-on for Sheets. We’ll first get an API key from WooCommerce, and then set up a request to pull in WooCommerce order data to your spreadsheet.
- Before You Begin
- Part 1: Get your WooCommerce API Key
- Part 2: Create your API Request URL
- Part 3: Pull WooCommerce API Data into Sheets
- Part 4: More Example API URLs
- Part 5: Handle Pagination
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: GET YOUR WOOCOMMERCE API KEY
- While logged into your WordPress account, click WooCommerce > Settings from the sidebar menu.
- Click the Advanced tab, and then the REST API sub tab. Finally, click either the “Add key” or the “Create an API key” button.
- You’ll be presented with a screen to create your API key. Enter in a brief description and click “Generate API key”
- You will now see your consumer key and consumer secret. Copy these down and keep them safe as we’ll need them in a moment (and they won’t be displayed again). You now have all you need to access the WooCommerce API!
We’ll follow the documentation to access a list of orders.
- API root: https://YOUR_DOMAIN/wp-json/wc/v3/
- Endpoint: /orders
- URL parameters: consumer_key=YOUR_KEY&consumer_secret=YOUR_SECRET&per_page=100
The per_page parameter isn’t required, but we’ll include it to show how it works. Putting it together, we get the full API Request URL:
Now let’s enter our URL into API Connector and import WooCommerce data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create screen, enter the Request URL we just created
- We don’t need any Headers, so just leave that section blank. We don’t need any extra authentication either so leave that set to None.
- Create a new tab and click ‘Set current’ to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see a list of your 100 most recent WooCommerce orders in your Google Sheet:
You can check the documentation for the full list of available API requests, but if you just want to jump in, you can play around with the URLs you enter in the API URL path field. Try the following (one at a time):
PART 5: HANDLE PAGINATION
- Note that WooCommerce limits the number of records returned in each request. By default, only 10 records will be returned unless you use the ‘per_page’ parameter as shown above (documented here).
- To access more than 25 records, add the ‘page’ and ‘per_page’ parameters like this:
page 2:With API Connector, you can either set these up as separate requests or loop through them automatically with pagination handling (paid feature) for added efficiency, like this: