Use this robust n8n workflow to reliably fetch all Shopify orders, overcoming the 250-item API limit via looping, and summarize sales data by SKU into Google Sheets. Download the n8n templates today.
Download this n8n workflow template and start using it instantly.
E-commerce Analysts needing reliable, automated sales reports.
Shopify Merchants who frequently hit API limits when querying large datasets.
Data Engineers looking for sophisticated n8n templates for handling API pagination.
Users seeking to implement complex logic using a custom code n8n node for data aggregation.
Extracting large datasets from services like Shopify can be challenging due to API pagination limits (typically 250 records per request). This specialized n8n workflow solves this problem by implementing a sophisticated looping mechanism using the n8n trigger, If, and GraphQL nodes. It reliably pulls all orders placed within the last 30 days, regardless of the volume, and aggregates the sales data (quantity and revenue) by product SKU.
After all data is collected across multiple pages, a custom JavaScript n8n node cleans and summarizes the information before the final results are automatically logged into a Google Sheet. This makes the entire process of monthly or weekly sales reporting effortless, demonstrating the powerful capabilities of an automated n8n solution.
This powerful n8n workflow starts with a scheduled n8n trigger:
searchPeriod) dynamically calculates the startDay (30 days ago) and endDay (today) to define the specific window for the Shopify order extraction.getOrderDoLoop) makes the initial call to the Shopify API, requesting the maximum limit of 250 orders, filtered by the date range.pageInfo.hasNextPage. hasNextPage is true, the flow loops back to the getOrderDoLoop n8n node, passing the endCursor to fetch the next 250 results. This effective use of the n8n trigger and logic ensures full dataset retrieval.hasNextPage is false, the workflow exits the loop and passes execution to the Code n8n node (groupItemListbyVendor). This custom n8n node iterates through all previous executions of the getOrderDoLoop node to gather all batches of orders, flattens the complex line item structure, and groups the resulting data by SKU, calculating total sales and total quantity sold.To use this reliable n8n workflow, follow these steps:
getOrderDoLoop GraphQL n8n node.https://your-store.myshopify.com/admin/api/2025-01/graphql.json).Google Sheets). Schedule Trigger (n8n trigger): The entry point for the n8n workflow. Triggers the execution automatically based on a predefined schedule (e.g., daily).
Set (searchPeriod n8n node): Defines the date range for the Shopify query, calculating the start day (30 days prior) and end day using n8n expressions.
GraphQL (getOrderDoLoop n8n node): Interfaces with the Shopify Admin API. Key configuration uses dynamic expressions to insert the endCursor for pagination and date filtering from the searchPeriod n8n node output.
If (is hasNextPage = true n8n node): Controls the pagination loop. Checks the data.orders.pageInfo.hasNextPage boolean. If true, the n8n node directs flow back to the GraphQL node.
Code (groupItemListbyVendor n8n node): The crucial customization point. This n8n node uses JavaScript to iterate over all data outputs generated by the looping GraphQL node, consolidates the line items, and groups the final sales data by SKU before outputting the summary.
Google Sheets (n8n node): The final action. Appends the structured, aggregated SKU sales summary data into the target Google Sheet document.
Use this powerful n8n workflow to scrape website content, generate Gemini vector embeddings, and store them efficiently in Pinecone for Retrieval-Augmented Generation (RAG) knowledge bases.

Automate first-round candidate screening using this powerful n8n workflow. It uses Gemini AI to match CVs from Gmail against JDs, log results to Google Sheets, and send actionable summaries to Slack.

Use this powerful n8n workflow to automatically detect high-priority Zendesk tickets, create urgent tasks in ClickUp, and dispatch real-time priority alerts via Telegram. An essential n8n template for support teams.

Use this powerful n8n workflow to instantly fetch country-specific Google Trends reports by sending a simple country code message to your Telegram bot. Get top insights automatically.

A software developer obsessed with automation, systems, and webhooks. I launched Strategiflows to help businesses scale smarter, not harder. What started as a few clever workflows turned into a multi-million dollar success — all powered by automation.







































