Search API Connector Documentation
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: Pull Data from WooCommerce to Sheets
- Part 3: Create a Custom API Request
- Part 4: Handle Pagination
- Part 5: API Documentation
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. Congrats, you can now access the WooCommerce API.
The easiest way to get started with the WooCommerce API is through API Connector’s built-in integration.
- Select WooCommerce from the drop-down list of applications
- Choose an endpoint.
- Enter the required parameters:
- Optionally set any optional parameters such as dates, limits, or product filters
- Select a destination sheet, name your request, and click Run.
- By default, WooCommerce returns a lot of fields, so filter out any you don't need using API Connector's field editor.
Alternatively, you can run your own custom requests instead of using API Connector’s pre-built integration, using any of the parameters and endpoints shown in WooCommerce's API documentation. To create a custom request, add the complete URL into the request URL field:
To easily convert from a preset request to a custom API URL, tick the Add request URL box before running your preset request (under Output options). This will print out your complete API URL, which you can then copy/paste into the request URL field.
Part 4: Handle Pagination
- WooCommerce limits the number of records returned in each request. By default, only 10 records will be returned unless you use the
per_pageparameters as shown below.
- With API Connector you can loop through these pages automatically with pagination handling (paid feature). WooCommerce provides next page URLs in a Link header (documented here), so set the
per_pageparameter to 100 and cycle through each page like this:
- Pagination type:
next page URL
- Field name:
- Run until: choose when to stop fetching data
- Pagination type:
Part 5: API Documentation
Official API documentation: https://woocommerce.github.io/woocommerce-rest-api-docs/#introduction