WooCommerce Google Sheets is a small Google Apps Script integration that imports WooCommerce orders into a Google Sheet. It supports paginated stores, keeps existing sheet formatting intact, and can run manually or on a schedule.
- Fetches every WooCommerce order after a configurable start date
- Handles WooCommerce REST API pagination in batches of 100 orders
- Imports billing, shipping, payment, totals, products, refunds, and order metadata
- Removes exact duplicate rows after each sync
- Copies the formatting from the first data row to every newly imported row
- Preserves existing cell styles when removing duplicates
- Supports manual runs and Google Apps Script time-driven triggers
- Uses no server, package dependency, build step, tracking, or external service
- A WooCommerce store with HTTPS enabled
- A WooCommerce REST API key with Read permission
- A Google account with access to Google Sheets and Apps Script
- Create or open the Google Sheet that should receive the orders.
- Open Extensions > Apps Script.
- Replace the editor contents with
Code.gs. - Save the project.
- Configure the active sheet as described below.
- Select
start_syncv2in the Apps Script toolbar and choose Run. - Approve the requested spreadsheet and external-request permissions.
The script always imports into the sheet that is active when start_syncv2
runs.
Use rows 3 through 6 for configuration and row 7 for the order headings:
| Cell | Setting | Example |
|---|---|---|
B3 |
WooCommerce store URL, without a path | https://shop.example.com |
B4 |
REST API consumer key | ck_... |
B5 |
REST API consumer secret | cs_... |
B6 |
Earliest order date | 2026-01-01 |
Add these headings to cells A7:Z7, in order:
| Columns | Headings |
|---|---|
A:F |
First Name, Last Name, Billing Address, Phone, Email, Shipping |
G:L |
Customer Notes, Payment Method, Total, Total Tax, Discount, Refunded Total |
M:R |
Items, Quantity, Refund Reason, Order ID, Date Created, Date Modified |
S:X |
Status, Order Key, Currency, Cart Tax, Shipping Total, Shipping Tax |
Y:Z |
User Agent, IP Address |
Order data starts on row 8. Each worksheet can use its own store credentials and start date.
Format cells A8:Z8 as the template for order rows. On every sync, the script
copies only that row's formatting to new rows before writing their values.
Colors, borders, fonts, alignment, wrapping, and number formats are therefore
kept consistent as the sheet grows.
Duplicate cleanup calls clearContent() only on the order data range. It never
calls clear(), so sheet formatting is not removed. Configuration and heading
rows are not included in duplicate cleanup.
- In WordPress, open WooCommerce > Settings > Advanced > REST API.
- Select Add key.
- Enter a description such as
Google Sheets order sync. - Choose the user that should own the key.
- Set permissions to Read.
- Select Generate API key and copy both generated values into
B4andB5.
The script sends the key through an HTTP Basic Authorization header. It does not include credentials in the request URL.
To run the import on a schedule:
- Open the Apps Script project.
- Select Triggers in the left sidebar.
- Choose Add Trigger.
- Select
start_syncv2as the function. - Choose Time-driven and the interval you want.
- Save the trigger.
The scheduled trigger uses whichever sheet was active when the spreadsheet was last saved. For predictable automation, keep the intended order sheet active.
The consumer key and secret are stored in the spreadsheet, so only share the sheet with people who are allowed to access WooCommerce order data. Use a dedicated read-only API key and revoke it immediately if the spreadsheet is shared accidentally.
Order data is sent directly from WooCommerce to Google Apps Script and the connected spreadsheet. This project adds no analytics or third-party service. Google and WooCommerce remain subject to their own data-processing terms.
- HTTP 401: Check the consumer key and secret, confirm the key has not been revoked, and verify that the selected WooCommerce user is still active.
- HTTP 404: Confirm that
B3contains the store root URL and that the WooCommerce REST API is available at/wp-json/wc/v3/orders. - No orders imported: Check that orders exist after the date in
B6. - Incorrect formatting: Apply the intended order-row style to
A8:Z8, then run the sync again. - Authorization prompt: Run
start_syncv2once from the Apps Script editor before creating a trigger.
Apps Script execution logs are available from Executions in the project sidebar.
The project is plain Google Apps Script JavaScript and has no build step. Keep
the output array in order_to_row() aligned with the A7:Z7 heading order when
adding or rearranging fields.
WooCommerce Google Sheets is free software licensed under the MIT License.