Search API Connector Documentation

Print

Import Shopify GraphQL Data to Google Sheets

The main Shopify tutorial uses the REST API because it’s easier to navigate and supports standard pagination methods. Shopify also provides a GraphQL API, which allows more specificity in terms of the fields that you retrieve and can be convenient in some cases.

Step-by-Step GraphQL Example

Below is a full example of how to fetch data from Shopify’s GraphQL API into Sheets with API Connector.

  1. Create your graphQL query and enter it into a cell, let’s say cell A1 of a sheet called Input. Here is an example of a valid graphQL query:
    query myQuery { orders(first: 50) { edges { cursor node { createdAt id name email displayFulfillmentStatus lineItems(first: 10) { edges { node { quantity title } } } } } pageInfo { hasNextPage } } } 
    shopify-graphql-query
  2. Encode the whole block by creating a new cell with this formula: =ENCODEURL(A1)
    shopify-graphql-encodeurl
  3. Back in the API Connector sidebar, choose the POST method.
  4. Enter a request URL that references your encoded cell, like this: https://YOUR_SHOP_NAME.myshopify.com/admin/api/2022-07/graphql.json?query=+++Input!A3+++
    shopify-graphql-url
  5. Under Headers, enter the following (get your API token as described here):
    X-Shopify-Access-TokenYOUR_API_TOKEN
    Content-typeapplication/json
  6. In the request body, enter {} (we don’t need a POST body here but it can’t be empty)
  7. Click Run to see the results in your sheet.
    shopify-graphql-results

Notes

Previous Import Shopify Data to Google Sheets
Next Import Spotify Data to Google Sheets

Leave a Comment

Table of Contents