Data Reporting Automation for E-commerce Sales and Product Analytics - n8n Workflow

This advanced n8n workflow template automates weekly e-commerce reporting, using an HTTP request n8n node to fetch order data, logging detailed reports to Google Sheets, and notifying users via Gmail.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • E-commerce Analysts and Managers who require weekly sales and product performance summaries.

  • Businesses using platforms like Magento 2 (or similar API-driven systems) who need automated reporting without manual data extraction.

  • Users of n8n who need production-ready n8n templates for integrating scheduled API data pulls with Google Sheets and email alerts.

Overview

This robust automation provides a complete solution for scheduled business intelligence reporting. Many businesses struggle with manually pulling e-commerce sales data, processing it, and compiling comprehensive weekly reports. This n8n workflow eliminates that manual labor entirely. It is designed to run on a set schedule (the critical n8n trigger), automatically calculates the relevant reporting period, queries an external API (like Magento 2) using the HTTP Request n8n node, and meticulously processes the raw data. It then splits the information into a high-level weekly summary and a detailed product breakdown, logging both records into separate Google Sheets. Finally, it uses the Gmail n8n node to send a notification once the data logging is complete, ensuring stakeholders are immediately informed. This approach guarantees timely, accurate reporting and maximizes the value of your existing n8n setup.

How it Works

This n8n workflow executes a precise sequence of steps to deliver a complete weekly sales report:


  1. Scheduled Start: The entire process begins with the 'Schedule Trigger' n8n trigger, typically configured to run weekly (e.g., every Monday morning).

  2. Date Calculation: The 'GET Week Dates' Code n8n node calculates the exact start and end timestamps for the previous reporting week, a necessary parameter for the API call.

  3. Spreadsheet Initialization: The 'Create spreadsheet' Google Sheets n8n node is configured, likely setting up the environment or generating a dynamic sheet based on the current date parameters.

  4. Data Fetching: The 'Get Last Week Orders' HTTP Request n8n node uses the calculated dates to query the external e-commerce API (e.g., Magento 2) to retrieve all orders placed within that defined period.

  5. Initial Processing: A primary 'Code' n8n node processes the raw JSON response, cleaning, structuring, and preparing the data for reporting.

  6. Branching & Calculation: The flow branches into two independent paths:

Weekly Summary: The 'Weekly Summary' Code n8n node calculates overall metrics (e.g., total sales, average order value, total orders).
Product Breakdown: The 'Product Breakdown' Code n8n node calculates item-level metrics (e.g., units sold per SKU, revenue per product).

  1. Data Logging: The flow utilizes two separate Google Sheets n8n nodes ('Log Weekly Summary' and 'Log Products Breakdown') to append the calculated data to predefined spreadsheets, providing structured historical data.

  2. Final Alert: Once the high-level summary is successfully logged, the 'Send a message' Gmail n8n node sends a notification email to stakeholders, confirming that the weekly report generation is complete and ready for review. This robust n8n workflow ensures data integrity and timely delivery.

Installation Guide

To use this powerful n8n template, follow these steps:


  1. Import: Copy the provided JSON and import it directly into your n8n instance.

  2. Credentials Setup:

Google Sheets: Configure credentials for the Google Sheets n8n node to allow access to your target spreadsheet. You will need to specify the Spreadsheet ID and sheet names in the logging nodes.
Gmail: Configure credentials for the Gmail n8n node, specifying the account that will send the summary email.
* HTTP Request: Update the 'Get Last Week Orders' HTTP Request n8n node parameters with your e-commerce API endpoint (URL), authentication keys (if required), and ensure the date parameters are correctly mapped using the output from the 'GET Week Dates' n8n node.

  1. Code Review: Review the three 'Code' n8n nodes ('GET Week Dates', 'Code', 'Weekly Summary', 'Product Breakdown') to adjust any logic specific to your API response format or currency/date formatting needs.

  2. Activation: Activate the n8n workflow after ensuring the 'Schedule Trigger' is set to your desired recurrence (e.g., Weekly).

Node Details

Schedule Trigger (n8n trigger): The starting point of the n8n workflow. Configured to run automatically on a recurring schedule (e.g., weekly) to initiate the reporting cycle.
GET Week Dates (Code n8n node): Essential for dynamic reporting. This node uses JavaScript to calculate the precise start and end dates/times for the previous week, feeding these values into the subsequent API request.
Get Last Week Orders (HTTP Request n8n node): Acts as the primary data extractor. It connects to the external e-commerce platform API (likely Magento 2) and filters the orders based on the dates provided by the previous n8n node.
Code (n8n node): Intermediate data transformation. Processes the raw JSON response from the HTTP request, often normalizing field names or filtering unnecessary data before the summaries are calculated.
Weekly Summary & Product Breakdown (Code n8n nodes): These two nodes calculate the required business metrics. They aggregate the processed order data into two distinct reports: high-level totals and detailed item performance metrics.
Log Weekly Summary & Log Products Breakdown (Google Sheets n8n nodes): Critical output nodes for logging historical data. They append the summarized and product-specific data, respectively, into designated rows within Google Sheets, building a permanent data store.


  • Send a message (Gmail n8n node): The final communication step. Sends a simple alert or a formatted summary email to stakeholders, confirming successful completion of the automated n8n workflow and data availability.

Related n8n Workflows

Paid

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by
Kanaka Kishore Kandregula
Kanaka Kishore Kandregula

Experienced Magento 2 Developer with 10+ years of expertise in building and optimizing eCommerce solutions. Over the past year, I’ve expanded my skills into workflow automation using n8n, streamlining business processes and integrating systems for efficiency. Passionate about solving complex problems, enhancing performance, and leveraging automation to drive smarter workflows.

Featured*