Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 2.27 KB

README.md

File metadata and controls

63 lines (47 loc) · 2.27 KB

WooCommerce to Google Sheets Integration

This Google Apps Script fetches product data from a WooCommerce store and writes it to an active Google Sheet.

Prerequisites

  • A WooCommerce store with API access enabled.
  • Google Sheets with Google Apps Script enabled.

Setup

  1. WooCommerce API Credentials:

    • Log in to your WooCommerce store.
    • Navigate to WooCommerce > Settings > Advanced > REST API.
    • Create a new API key with Read permissions.
    • Note down the Consumer Key and Consumer Secret.
  2. Google Sheets:

    • Open a new or existing Google Sheet.
    • Go to Extensions > Apps Script.
  3. Google Apps Script:

    • Copy the contents of script.js into the script editor.
    • Replace the placeholders in the script with your WooCommerce API credentials:
      const API_URL = 'https://example.com/wp-json/wc/v3'; // Replace with your WordPress site URL
      const CONSUMER_KEY = 'consumer key'; // Replace with your Consumer Key
      const CONSUMER_SECRET = 'consumer secret'; // Replace with your Consumer Secret
  4. Run the Script:

    • Save the script.
    • Click the Run button to execute the script.
    • Authorize the script to access your Google Sheet and make external requests.

Usage

Logging

  • The script logs the status of the data fetch process. You can view the logs by going to View > Logs in the Apps Script editor.

Troubleshooting

  • Ensure that your WooCommerce API credentials are correct.
  • Make sure that the WooCommerce API is enabled and accessible.
  • Check the Google Apps Script logs for any error messages.

License

This project is licensed under the MIT License.