GraphQL data displays as a single row in Google Sheets?

upc278999
New Member
9 0 0

I'm retrieving Shopify API data using the query below in Google Sheets. The query retrieves Shopify products and their delivery profile. But all products are being displayed in a single row based on their delivery profile? For instance, if 10 products are in delivery profile ($100 Shipping) then all 10 products for that delivery profile would appear in a single row together with their delivery profile data like first example below. But I want each product to be displayed on separate rows with the delivery profile data in the columns beside it like the second example below *I am also not sure of how to setup the proper pagination for this query to pull 'all products'.

Example 1:
product #1 | product #2 | deliveryProfile ($100 shipping) 
product #1 | product #2 | deliveryProfile ($50 shipping) 

Example: 2:
product #1 | deliveryProfile ($100 shipping)
product #2 | deliveryProfile ($100 shipping)
product #1 | deliveryProfile ($50 shipping)
product #2 | deliveryProfile ($50 shipping)

 

query ($cursor: String) {
  deliveryProfiles (first: 5) {
    edges {
      node {
        profileItems (first: 5, after: $cursor) {
          edges {
           cursor
            node {
              product {
                id
                handle
              }
              variants (first: 5) {
                edges {
                  node {
                    id
                    title
                  }
                }
              }
            }
          }
        }
        profileLocationGroups {
          locationGroupZones(first: 5) {
            edges {
              node {
                methodDefinitions(first: 5) {
                  edges {
                    node {
                      rateProvider {
                        ... on DeliveryRateDefinition {
                          id
                          price {
                            amount
                          }
                        }
                        ... on DeliveryParticipant {
                          id
                          fixedFee {
                            amount
                            currencyCode
                          }
                          percentageOfRateFee
                          participantServices {
                            active
                            name
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }        
      }
    }
  }
}

 

 

0 Likes
upc278999
New Member
9 0 0

Solved: If you are using the API Connector (Add-On) for Google Sheets to import data from Shopify AND you are using a GraphQL Query you have to go into the API Connector's [Output Options] menu and change Report style to [Compact] to display the individual records on their own rows.

0 Likes