Automatic Square Sales Reporting to Outlook - n8n Workflow

Automate monthly Square sales reporting with this advanced n8n workflow. It uses the Square API to calculate detailed sales, tax, and tender summaries for all locations, sending the final report as a CSV attachment via Microsoft Outlook. Explore this robust n8n templates solution.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Business Owners & Managers: Who need timely, accurate monthly sales data from Square without manual exports.
Financial Accountants/Bookkeepers: Requiring automated sales data feeds for QuickBooks or other accounting software.
n8n Automation Specialists: Looking for robust examples of complex API integration and custom sales aggregation within an n8n workflow.
Operations Teams: Needing aggregated performance metrics across multiple Square locations.

Overview

Managing sales data across multiple Square locations can be time-consuming, especially when needing detailed summaries for accounting and forecasting. This advanced n8n workflow eliminates that manual burden entirely.

This specific n8n templates solution acts as an automatic finance analyst. It uses the n8n trigger node to fire on the first day of every month, calculates data for the preceding month, interacts with the Square API via multiple HTTP requests, and aggregates detailed metrics (including returns, taxes, tips, and tenders) using a custom n8n node (Code).

The final result is a highly accurate, customizable sales summary that mirrors the data found in the Square Sales Summary Dashboard. The entire process culminates in the report being converted into a tidy CSV file and delivered directly to the designated recipient using the Microsoft Outlook n8n node, ensuring compliance and efficiency. This is a powerful example of what an n8n workflow can achieve in financial operations.

How it Works

This highly detailed n8n workflow operates on a monthly cadence to generate and distribute sales reports:


  1. Monthly Activation: The process begins with the Schedule Trigger, an essential n8n trigger, set to run at 8:00 AM on the first day of every month.

  2. Date Range Calculation: The 'Get Dates From Last Month' Code n8n node calculates every single date that comprised the previous calendar month. This creates individual items for each day, allowing the workflow to iterate accurately.

  3. Location Retrieval: The n8n workflow uses an HTTP Request n8n node to fetch a list of all active Square locations associated with the account.

  4. Data Fetching Loop: The 'Turn Locations Into List' node splits the workflow to process data for each location. For every day of the previous month and every location, the 'Get Sales from Square' HTTP Request n8n node searches for all completed orders via the Square Orders API.

  5. Data Filtering: The 'Ignore Locations w/o Sales' If n8n node ensures that the workflow continues only if sales data (orders) was successfully returned for that location/day combination.

  6. Report Compilation: The crucial 'Compile Sales Reports' Code n8n node runs complex JavaScript logic. It loops through all orders, accurately calculating and aggregating total sales, discounts, returns, tax, tips, and tender types (Card, Cash, Gift Card), ensuring the final figures align with the Square Sales Summary dashboard. All amounts are divided by 100 to convert from cents to dollars.

  7. File Generation: The compiled summary JSON is converted into a structured CSV file using the Convert To File n8n node, ready for attachment.

  8. Distribution: Finally, the 'Send Report' Microsoft Outlook n8n node takes the newly created CSV file as a binary attachment and emails the monthly report to the configured recipient.

Installation Guide

To set up this powerful n8n workflow, follow these steps:


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

  2. Square API Credential Setup (Header Auth):

Go to Credentials and create a new Header Auth credential.
Set the Name field to Authorization.
Set the Value field to your Square Access Token, prefixed with Bearer (e.g., Bearer EAA...).
Apply this credential to both the 'Get Square Locations' and 'Get Sales from Square' HTTP Request n8n nodes.

  1. Microsoft Outlook Credential:

Set up or select your existing Microsoft Outlook credential for the 'Send Report' n8n node.

  1. Configure Email Recipient:

In the 'Send Report' n8n node, update the To Recipients field (currently [email protected]) to the email address of the finance team or manager.

  1. Activate: Save the n8n workflow and set the Schedule Trigger to Active.

Node Details

Schedule Trigger (n8n trigger):
Function: Starts the n8n workflow monthly.
Key Configuration: Runs at 8:00 AM on the first day of every month.
Get Dates From Last Month (Code n8n node):
Function: Dynamically calculates the full date range of the previous calendar month, outputting an item for each day.
Key Configuration: Uses JavaScript to handle precise date calculations relative to the workflow trigger date.
Get Square Locations (HTTP Request n8n node):
Function: Fetches all available locations from the Square API, ensuring comprehensive coverage for the n8n workflow.
Key Configuration: Uses 'Header Auth' with the Square Access Token.
Get Sales from Square (HTTP Request n8n node):
Function: Retrieves all completed orders for a specific location and day.
Key Configuration: Uses a POST request with a complex JSON body configured to filter by locationids and precise date ranges pulled from the previous n8n nodes.
Compile Sales Reports (Code n8n node):
Function: Aggregates all raw order data (which includes sales, refunds, and tenders) into a clean, summarized financial report format, crucial for this n8n templates solution.
Key Configuration: Extensive JavaScript code calculates netsales, grosssales, totalreturns, and breakdowns by tender type, scaling the results from cents to dollars.
Convert Sales Summary to CSV File (Convert To File n8n node):
Function: Converts the structured JSON output from the compilation step into a file format suitable for emailing.
Key Configuration: Dynamic file naming: =salesreport{{ $('Schedule Trigger').item.json.timestamp }}.csv, using the binary property salesreport.
Send Report (Microsoft Outlook n8n node):
Function: Sends the finalized CSV report via email.
* Key Configuration: Uses the binary property sales
report as an attachment. Requires an Outlook credential and configuration of the recipient email address.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by
Rosh Ragel
Rosh Ragel

Featured*