Search API Connector Documentation
Import Shopify Data to Google Sheets
In this guide, we’ll walk through how to pull data from the Shopify API directly into Google Sheets, using the API Connector add-on for Sheets.
The nice thing about this method is that you can access the entire set of functionality available via Shopify's API, from pulling in transactions to updating product specs.
- Before You Begin
- Part 1: Get your Shopify Admin API Access Token
- Part 2: Pull Data from Shopify to Sheets
- Part 3: Create a Custom Request
- Part 4: Handle Pagination
- Part 5: Get New Data Only
- Part 6: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your Shopify Admin Access Token
- Log into your Shopify store and click Apps
- From here, click Develop apps
- From here, click the Create an app button
- You'll see a modal prompting you to name your app and assign an app developer. Give it a name and click Create app.
- You'll now be on your app overview screen. Click Configure Admin API scopes.
- The next section is where you search for and select which data points you'd like to have access to via the API. Most likely, you will want access to at least one or more of the following: read_orders, read_products, read_inventory, and read_customers.
- Once you've selected all the scopes you want to access, click Save. (You can add more scopes later if you need to)
- Head over to the API credentials tab and click Install app.
- Confirm the installation and you should now see a screen containing your Admin API access token. Click Reveal token once, and store it safely as we'll need it soon. Congrats, you’re done! You now have access to the Shopify API.
Part 2: Pull Data from Shopify to Sheets
The easiest way to get started with the Shopify API is through API Connector’s built-in integration.
- Select Shopify from the drop-down list of applications
- Under Authorization, enter your API token
- Select an endpoint. We’ll start by pulling in a simple orders report
- Under the shop parameter, enter your shop name. For example, if your admin URL is
https://oj-stand.myshopify.com/admin, your shop name is
oj-stand. You can also find your shop name by navigating to your store page, right-clicking View Page Source and searching for "Shopify.shop" in the HTML source code.
- Set a destination sheet, name your request, and click Run to see response data in your sheet.
Part 3: Create a Custom Request
Alternatively, you can run your own custom requests instead of using API Connector’s pre-built integration, using any of the endpoints and parameters shown in the API documentation.
To create a custom request, enter the complete URL into the request URL field and include a header of Key = X-Shopify-Access-Token, Value = your token
To easily convert from a preset request to a custom API URL, tick the Add request URL box before running your preset request (under Output options). This will print out your complete API URL, which you can then copy/paste into the request URL field.
Part 4: Handle Pagination
- By default, Shopify limits the number of responses returned at once, usually to 50 records at a time.
To get more, set the
limitparameter to 250. Fetch additional data by using the "since_id" or date-based parameters.
- Loop through and grab all your data automatically with pagination handling (paid feature), like this:
- Pagination type:
next page URL
- Next page path:
- Run until: choose when to stop fetching data
- Pagination type:
Part 5: Get New Data Only
Rather than retrieving the entire data set each time you run your request, you can set your request to fetch new data only. There are a few approaches you could take; here’s one:
- For this example, we’ll create a custom request. As mentioned above, if you're starting from a preset request you can convert it into a custom request by ticking the Add Request URL box.
- Run an initial request for the dates and fields you want to start with, e.g.
- Use the field editor to select just the fields you want and assign them to specific columns in your report.
- Create a new sheet called MaxId that contains the function
=to_text(max(Orders!A:A)). Replace A:A with whichever column contains your order IDs.
- Now reference that max ID cell in your request URL and pull in new data only with a custom request URL of
- This will ensure that each request starts from the end of the prior data pull. Select Append mode to add each new data pull to the end of your existing dataset.
- Set your request to run on a schedule. You won’t need to update your request again.
Part 6: API Documentation
Official documentation: https://shopify.dev/api/admin-rest