Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
alan19
Frequent Visitor

Shopify API

I am trying to bring shopify  orders into Power BI desktop but seems I can not import more than 250 orders, this query brings 250 orders and fails at 251. anyone has any idea?

Thank you.

 

let
    key = "API",
    delay = #duration(0, 0, 2, 0), 
    GetOrdersWithSinceId = (since_id as nullable text) as record =>
        let
            queryParameters = if since_id = null then
                [
                    status = "any",
                    limit = "250",
                    order = "created_at asc"
                ]
            else
                [
                    status = "any",
                    limit = "250",
                    order = "created_at asc",
                    since_id = since_id
                ],
            response = Json.Document(
                Web.Contents(
                    url,
                    [
                        Headers = [#"X-Shopify-Access-Token" = key],
                        Query = queryParameters
                    ]
                )
            )
        in
            response,
    GetMaxId = (orders as list) as nullable text =>
        try
            Text.From(List.Max(List.Transform(orders, each _[id])))
        otherwise
            null,
    GetAllOrders = List.Generate(
        () => [since_id = null, result = GetOrdersWithSinceId(null), orders = GetOrdersWithSinceId(null)[orders]],  
        each List.Count([orders]) > 0,  // condition to continue
        each [
            since_id = GetMaxId([orders]), 
            result = Function.InvokeAfter(() => GetOrdersWithSinceId(since_id), delay),
            orders = result[orders]
        ],  
        each [orders]  
    ),
    ExtractOrders = List.Combine(List.Transform(GetAllOrders, each _)),
    OrdersTable = Table.FromList(ExtractOrders, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(OrdersTable, "Column1", {"id", "created_at", "total_price", "customer", "line_items"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1", {
        {"created_at", type datetimezone}
    }),
    #"Sorted Rows" = Table.Sort(#"Changed Type",{{"created_at", Order.Ascending}})
in
    #"Sorted Rows"
 
4 REPLIES 4
ReportGuru
Post Patron
Post Patron

Hi @alan19 were you able to find a solution? As other comment mentioned, having a custom connector for Shopify is hard as it requires some technical knowledge. As a workaround, maybe you can try to test your connection with a 3rd party connector. I've tried windsor.ai, supemetrics and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. In case you wonder, to make the connection first search for the Shopify connector in the data sources list:

 

SHOPIFY-1.jpg

 

After that, you need to follow instructions and install the windsor.ai app from the Shopify App Store:

 

SHOPIFY-1.5.png

 

then on preview and destination page you will see a preview of your Shopify fields

 

SHOPIFY-2.jpg

 

There just select the fields you need. Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url.

 

SELECT_DESTINATION_NEW.png

EugeneLebedev
Helper IV
Helper IV

Shopify API is too difficult to create a custom Power BI connector in my opinion. I would recommend instead to extract data into an Azure SQL Server database. This way you work around most of the Shopify API limitations. Here is a ready-made solution for that: https://vidi-corp.com/shopify-power-bi-connector/

WanderingBI
Resolver III
Resolver III

The Shopify API seems to limit input arrays to 250 entries:

 

Shopify API rate limits 

"Input arguments that accept an array have a maximum size of 250. Queries and mutations return an error if an input array exceeds 250 items."

this is right but any idea how to deal with it?

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors