1. Home
  2. Docs
  3. Custom API Examples
  4. Import Shopify Data to the Google Sheets

Import Shopify Data to the Google Sheets

Shopify is one of the best e-commerce platform which helps users to start, run and grow your e-commerce store.

There are 2 methods to import the Shopify data into google sheets.

  1. [NEW] One click integration via DigiXport. [No token required] 
  2. Custom API method.

 

For quick start, you can follow the method no. 1 by clicking on the link below.


[NEW] One click integration via DigiXport. [No token required]


 

In this article, we’ll show you the Custom API method to get the Shopify data into google sheet. 

Once you get the token correctly, you can then use any endpoint as mentioned in their documentation. 

Let’s start with the setup.

 

Steps to fetch the Shopify access token:

Step 1: Create a Shopify custom app

Assuming you have a Shopify store live you can follow the below steps:

  • Go to your Shopify store & open the Shopify admin page.
  • (Old UI) On the left hand side click on Apps > Develop Apps.

shopify_digixport_create_app_ui 

  • (New UI) On the left hand side click on Apps > Develop Apps 

Shopify_new_UI_App

  • (New UI) Click on Apps and sales channels on left side menu
  • (New UI) Click on Develop Apps.

Shopify_custom_app_newui

 

  • (Old UI) Click on allow custom app development.

    shopify_digixport_create_app_customappdevelopment
    shopify_digixport_create_app_customappdevelopment_2

 

  • (New& Old UI ) Click on  Create an App. You can name it anything. (For Eg: GSheet)

shopify_digixport_create_app_name_ui

Step 2: Set Admin API access scopes

  • Once you have created an App,  go to Overview > Admin API Integration. Here you can select Admin API access scopes. You can include the following scopes: read_orders, read_products & read_customers. (You can include other scopes too as per your use case).
  • Click on Save.

shopify_digixport_customapp_scope_selection

 

Step 3: Get the Admin API access token

  • Go To Overview & click on Install App.

shopify_digixport_customapp_install

 

  • Go to API credentials section & click Reveal token once.
  • Copy the token

shopify_digixport_customapp_admin_api_access_token

 

NOTE: If there are any changes in the Shopify UI, you can follow the steps to create a custom shopify app and get the token from here.

 

 

Custom API Method – Steps to fetch Shopify Orders data in Google Sheet

Assuming you have selected the read_orders scopes in the above steps, we’ll now import the orders data.

Step – 1: Setup the API Url and Authorization header

  • You can enter the following URL in the API URL. Make sure to replace the {{store-name}} with your store name in the below URL.
  • We want orders data between a particular date range. So, we have entered the date range parameters as <<Sheet!A2>> to <<Sheet!B2>> which represents the values fetched from the sheet.
  • The fields which we have included in the URL are created_at, id, name, total-price. You can check the entire list of fields at the bottom of this article.

https://{{store-name}}.myshopify.com/admin/api/2022-01/orders.json?status=any&created_at_min=<<Sheet!A2>>&created_at_max=<<Sheet!B2>>&fields=created_at,id,name,total-price&limit=200

shopify_orders_date_digixport

 

  • We’ll manual add authorization header. Open the header row and enter Key and value as “X-Shopify-Access-Token” and “{{shopify_token}}”. {{shopify_token}} is the one you copied from the last step.
    Note: It is recommended to use the environment variable to store the token safely.

customapi_shopify_token

 

Step – 2: Import the data to google sheets

  • Click on Export.
  • You will see the data imported to the sheets with the fields mentioned in the URL for the date range from A2 to B2.

shopify_orders_data_digixport

 

Steps to fetch Shopify Customers data in Google Sheet

Most of the part is similar as we had done for importing the Orders data. You will need read_customers scope to import the customers data.

Step – 1: Setup the API Url and Authorization header

  • You can enter the following URL in the API URL. Make sure to replace the {{store-name}} with your store name in the below URL.
  • We want customers data between a particular date range. So, we have entered the date range parameters as <<Sheet!A2>> to <<Sheet!B2>> which represents the values fetched from the sheet.
  • The fields which we have included in the URL are id, email, first_name, last_name, total_spent. You can check the entire list of fields at the bottom of this article.

https://digixport.myshopify.com/admin/api/2022-01/customers.json?status=any&created_at_min=<<Sheet!A2>>&created_at_max=<<Sheet!B2>>&fields=id,email,first_name,last_name,total_spent&limit=200

shopify_orders_date_digixport

 

  • We’ll manual add authorization header. Open the header row and enter Key and value as “X-Shopify-Access-Token” and “{{shopify_token}}”. {{shopify_token}} is the one you copied from the last step.
    Note: It is recommended to use the environment variable to store the token safely.

customapi_shopify_token

 

Step – 2: Import the data to google sheets

  • Click on Export.
  • You will see the data imported to the sheets with the fields mentioned in the URL for the date range from A2 to B2.

shopify_customers_date_digixport

 

Filter/Order the columns/rows (Optional)

 

Key Points

  • It is recommended to use the “fields” parameter in the URL. If it is not included then all the fields will be imported.
  • To access the nested fields in the shopify api, you can use the top level fields & then filter the columns as shown here.
  • You can use the Sheet cell values to import the data with the dynamic date range. You can fetch the values of the parameters updated_at_min and updated_at_max from the google sheet. For Eg: https://your-development-store.myshopify.com/admin/api/2022-01/orders.json?updated_at_min=<<Sheet!A1>>&updated_at_max=<<Sheet!B1>>
  • You can schedule the query by using dynamic dates. for Eg: You can input date range in the sheet as “=Today()-7” to “=Today()” which will import last 7 days data.
  • For more information, you can check the Shopify REST admin API documentation

     

 

List of fields names for Shopify Orders API

Field Names
id
admin_graphql_api_id
app_id
browser_ip
buyer_accepts_marketing
cancel_reason
cancelled_at
cart_token
checkout_id
checkout_token
client_details
closed_at
confirmed
contact_email
created_at
currency
current_subtotal_price
current_subtotal_price_set
current_total_discounts
current_total_discounts_set
current_total_duties_set
current_total_price
current_total_price_set
current_total_tax
current_total_tax_set
customer_locale
device_id
discount_codes
email
estimated_taxes
financial_status
fulfillment_status
gateway
landing_site
landing_site_ref
location_id
name
note
note_attributes
number
order_number
order_status_url
original_total_duties_set
payment_gateway_names
phone
presentment_currency
processed_at
processing_method
reference
referring_site
source_identifier
source_name
source_url
subtotal_price
subtotal_price_set
tags
tax_lines
taxes_included
test
token
total_discounts
total_discounts_set
total_line_items_price
total_line_items_price_set
total_outstanding
total_price
total_price_set
total_price_usd
total_shipping_price_set
total_tax
total_tax_set
total_tip_received
total_weight
updated_at
user_id
billing_address
customer
discount_applications
fulfillments
line_items
payment_details
payment_terms
refunds
shipping_address
shipping_lines

List of fields names for Shopify Customers API

Field Names
id
email
accepts_marketing
created_at
updated_at
first_name
last_name
orders_count
state
total_spent
last_order_id
note
verified_email
multipass_identifier
tax_exempt
phone
tags
last_order_name
currency
addresses
accepts_marketing_updated_at
marketing_opt_in_level
tax_exemptions
sms_marketing_consent
admin_graphql_api_id
default_address

Leave a Reply

Your email address will not be published. Required fields are marked *