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 an 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 } } } 
  2. Encode the whole block by creating a new cell with this formula: =ENCODEURL(A1)
  3. Back in the API Connector sidebar, choose the POST method.
  4. Enter a request URL that references your encoded cell, like this:!A3+++
  5. Under Headers, enter the following (get your API token as described here):
  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.


Leave a Comment

Jump To