This workflow corresponds to n8n.io template #6460 — we link there as the canonical source.
This workflow follows the Gmail → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "422101f4-e7ed-49da-8a14-e7d8c4c4fad8",
"name": "Get Square Locations",
"type": "n8n-nodes-base.httpRequest",
"position": [
1040,
540
],
"parameters": {
"url": "https://connect.squareup.com/v2/locations",
"options": {},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "bcdd6eea-8cbc-4118-a461-e056aee9389a",
"name": "Turn Locations Into List",
"type": "n8n-nodes-base.splitOut",
"position": [
1260,
540
],
"parameters": {
"include": "selectedOtherFields",
"options": {},
"fieldToSplitOut": "locations",
"fieldsToInclude": "id"
},
"typeVersion": 1
},
{
"id": "49278d03-a7fa-4378-9ed7-e8a4a155e82c",
"name": "Ignore Locations w/o Sales",
"type": "n8n-nodes-base.if",
"position": [
1760,
540
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "498f5fab-6930-4e89-9fbe-0d67671da8d2",
"operator": {
"type": "array",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.orders }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "cc2cddc3-8771-4967-8766-7980e78d8361",
"name": "Get Sales from Square",
"type": "n8n-nodes-base.httpRequest",
"position": [
1520,
540
],
"parameters": {
"url": "https://connect.squareup.com/v2/orders/search",
"method": "POST",
"options": {},
"jsonBody": "={\n \"location_ids\": [\"{{ $json.locations.id }}\"],\n \"query\": {\n \"filter\": {\n \"state_filter\": {\n \"states\": [\"COMPLETED\"]\n },\n \"date_time_filter\": {\n \"created_at\": {\n \"start_at\": \"{{ $('Schedule Trigger').item.json.timestamp.toDateTime().minus(1, 'days').format('yyyy-MM-dd') }}T00:00:00-05:00\",\n \"end_at\": \"{{ $('Schedule Trigger').item.json.timestamp.toDateTime().minus(1, 'days').format('yyyy-MM-dd') }}T23:59:59-05:00\"\n }\n }\n }\n },\n \"limit\": 1000,\n \"return_entries\": false\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "68086eb5-a666-431c-9d29-8be060ca67e0",
"name": "Compile Sales Reports",
"type": "n8n-nodes-base.code",
"position": [
2040,
540
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Date and Location Metadata\nconst date = $('Schedule Trigger').item.json.timestamp.split('T')[0];\nconst location_id = $json.orders[0].location_id || null;\nconst location_name = $('Get Square Locations').item.json.locations.find(locations => locations.id === location_id)?.name;\n\n// Our Result Variables\nlet total_money = 0;\nlet total_tax = 0;\nlet total_discount = 0;\nlet total_tip = 0;\nlet total_returns = 0;\nlet cash_rounding = 0;\n\nlet cash_tender = 0;\nlet card_tender = 0;\nlet gift_card_tender = 0;\nlet other_tender = 0;\nlet fees = 0;\n\n// Loop Through Each Order\nfor (const sale of $json.orders) {\n\n // Add the sales, taxes, discounts and tips\n total_money += sale.total_money?.amount || 0;\n total_tax += sale.total_tax_money?.amount || 0;\n total_discount += -(sale.total_discount_money?.amount || 0);\n total_tip += sale.total_tip_money?.amount || 0;\n if (sale.rounding_adjustment) {\n cash_rounding += sale.rounding_adjustment.amount_money?.amount || 0;\n }\n\n \n if (sale.return_amounts) {\n // If there are returns, subtract from sales totals and add to return amount total\n total_money -= sale.return_amounts?.total_money?.amount || 0;\n total_tax -= sale.return_amounts?.tax_money?.amount || 0;\n total_discount -= sale.return_amounts?.discount_money?.amount || 0;\n total_tip -= sale.return_amounts?.tip_money?.amount || 0;\n \n total_returns += -(sale.return_amounts?.total_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.tax_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.tip_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.discount_money?.amount || 0);\n \n // If an array of refunds is provided\n for (const refund of sale.refunds || []) {\n const transaction_id = refund.transaction_id;\n \n // Look for the original sale this refund refers to\n const original_sale = $json.orders.find(original =>\n original.id && transaction_id && original.id.includes(transaction_id)\n );\n \n if (original_sale) {\n if (original_sale.rounding_adjustment) {\n const amount = original_sale.rounding_adjustment.amount_money?.amount || 0;\n cash_rounding -= amount;\n total_returns += amount;\n }\n \n if (original_sale.tenders) {\n for (const tender of original_sale.tenders) {\n if (tender.id === refund.tender_id) {\n const amount = refund.amount_money?.amount || 0;\n if (tender.type === 'CARD') card_tender -= amount;\n else if (tender.type === 'CASH') cash_tender -= amount;\n else if (tender.type === 'SQUARE_GIFT_CARD') gift_card_tender -= amount;\n else other_tender -= amount;\n \n if (refund.processing_fee_money && tender.id === refund.tender_id) {\n fees -= refund.processing_fee_money.amount || 0;\n }\n }\n }\n }\n }\n }\n }\n \n if (sale.tenders) {\n for (const tender of sale.tenders) {\n const amount = tender.amount_money?.amount || 0;\n if (tender.type === 'CARD') card_tender += amount;\n else if (tender.type === 'CASH') cash_tender += amount;\n else if (tender.type === 'SQUARE_GIFT_CARD') gift_card_tender += amount;\n else other_tender += amount;\n \n if (tender.processing_fee_money) {\n fees -= tender.processing_fee_money.amount || 0;\n }\n }\n }\n \n}\n\n// Final computed values\nconst net_sales = total_money - total_tip - total_tax - cash_rounding;\nconst gross_sales = net_sales - total_discount - total_returns;\nconst net_total = cash_tender + card_tender + gift_card_tender + other_tender + fees;\n\nreturn {\n json: {\n date,\n location_id,\n location_name,\n gross_sales: gross_sales / 100.0,\n total_returns: total_returns / 100.0,\n total_discount: total_discount / 100.0,\n net_sales: net_sales / 100.0,\n total_tax: total_tax / 100.0,\n total_tip: total_tip / 100.0,\n cash_rounding: cash_rounding / 100.0,\n total_payments_collected: total_money / 100.0,\n cash: cash_tender / 100.0,\n card: card_tender / 100.0,\n gift_card: gift_card_tender / 100.0,\n other: other_tender / 100.0,\n fees: fees / 100.0,\n net_total: net_total / 100.0,\n }\n};"
},
"typeVersion": 2
},
{
"id": "724bae71-92b1-4e6a-8319-6e652354af10",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"width": 660,
"height": 1440,
"content": "## Automatically Send Square Summary Report for Yesterday's Sales via Gmail\n\n## What It Does \nThis workflow automatically connects to the Square API and generates a daily sales summary report for all your Square locations. The report matches the figures displayed in **Square Dashboard > Reports > Sales Summary**.\n\nIt's designed to run daily and pull the previous day's sales into a CSV file, which is then sent to a manager/finance team for analysis.\n\nThis workflow builds on my previous template, which allows users to automatically pull data from the Square API into n8n for processing. (See here: https://n8n.io/workflows/6358)\n\n## Prerequisites \nTo use this workflow, you'll need:\n- A Square API credential (configured as a Header Auth credential)\n- A Gmail credential\n\n## How to Set Up Square Credentials: \n- Go to **Credentials > Create New** \n- Choose **Header Auth** \n- Set the **Name** to `Authorization` \n- Set the **Value** to your Square Access Token (e.g., `Bearer <your-api-key>`)\n\n## How It Works \n1. **Trigger:** The workflow runs every day at 4:00 AM \n2. **Fetch Locations:** An HTTP request retrieves all Square locations linked to your account \n3. **Fetch Orders:** For each location, an HTTP request pulls completed orders for the specified report_date \n4. **Filter Empty Locations:** Locations with no sales are ignored \n5. **Aggregate Sales Data:** A Code node processes the order data and produces a summary identical to Square\u2019s built-in Sales Summary report \n6. **Create CSV File:** A CSV file is created containing the relevant data \n7. **Send Email:** An email is sent to the chosen third party \n\n## Example Use Cases \n- Automatically send Square sales data to management to improve the quality of planning and scheduling decisions \n- Automatically send data to an external third party, such as a landlord or agent, who is paid via commission \n- Automatically send data to a bookkeeper for entry into QuickBooks \n\n## How to Use \n- Configure both HTTP Request nodes to use your Square API credential \n- Set the workflow to **Active** so it runs automatically \n- Enter the email address of the person you want to send the report to and update the message body \n- If you want to remove the n8n attribution, you can do so in the last node \n\n## Customization Options \n- Add pagination to handle locations with more than 1,000 orders per day\n- Instead of a daily summary, you can modify this workflow to produce a weekly summary once a week \n\n## Why It's Useful \nThis workflow saves time, reduces manual report pulling from Square, and enables smarter automation around sales data \u2014 whether for operations, finance, or performance monitoring.\n"
},
"typeVersion": 1
},
{
"id": "13fa48b6-e675-42f8-a67e-2f5d39f1b659",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
700,
340
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Trigger \n- This workflow runs every day at 8:00 AM. \n- Each day, it pulls the previous day's sales data from Square.\n"
},
"typeVersion": 1
},
{
"id": "a83dacf8-7231-4d93-9845-21e3c5cca012",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
960,
340
],
"parameters": {
"color": 5,
"width": 460,
"height": 420,
"content": "## Get Square Locations and Process Each One Separately \n- This HTTP node connects to the Square Locations API to fetch all your locations.\n"
},
"typeVersion": 1
},
{
"id": "ea95c17f-07ce-4710-b8ec-d608cf58d514",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
340
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Get Sales from Square \n- This HTTP node retrieves all orders for the given location on the specified date."
},
"typeVersion": 1
},
{
"id": "9aac8d39-0f23-4cd6-8776-bf8d04b9946a",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1980,
340
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Compile a Report for Each Location \n- This code node calculates totals for each location. \n- Please ensure the numbers match EXACTLY with the Square Sales Summary Dashboard.\n"
},
"typeVersion": 1
},
{
"id": "c40ab199-10c5-4b32-8dc4-b80a73da35ae",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
780,
540
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "0a84e6fa-7c95-4b62-a645-f78b8650a068",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
2240,
340
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Convert the Square Sales Summary into a CSV File \n"
},
"typeVersion": 1
},
{
"id": "213611ca-8b13-43fc-89b3-af1ac257bd13",
"name": "Convert Sales Summary to CSV File",
"type": "n8n-nodes-base.convertToFile",
"position": [
2320,
540
],
"parameters": {
"options": {
"fileName": "=sales_report_{{ $('Schedule Trigger').item.json.timestamp }}.csv"
},
"binaryPropertyName": "sales_report"
},
"typeVersion": 1.1
},
{
"id": "27ed7ca0-969e-4a9d-9b99-9f90b3a8fa8b",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
2500,
340
],
"parameters": {
"color": 5,
"height": 420,
"content": "## Send the Report to the Finance Team / Manager"
},
"typeVersion": 1
},
{
"id": "8e984b80-4a94-4c88-b77a-652593ebad10",
"name": "Send Report",
"type": "n8n-nodes-base.gmail",
"position": [
2560,
540
],
"parameters": {
"sendTo": "user@example.com",
"message": "<p>Hello User,</p>\n<p>Please see the attached report containing yesterday's sales!</p>\n<p>Best,<br> An Efficient Person</p>",
"options": {
"attachmentsUi": {
"attachmentsBinary": [
{
"property": "sales_report"
}
]
},
"appendAttribution": true
},
"subject": "=Your Square Sales Report for {{ $('Schedule Trigger').item.json['Readable date'].split(',')[0] }}"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
}
],
"connections": {
"Send Report": {
"main": [
[]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get Square Locations",
"type": "main",
"index": 0
}
]
]
},
"Get Square Locations": {
"main": [
[
{
"node": "Turn Locations Into List",
"type": "main",
"index": 0
}
]
]
},
"Compile Sales Reports": {
"main": [
[
{
"node": "Convert Sales Summary to CSV File",
"type": "main",
"index": 0
}
]
]
},
"Get Sales from Square": {
"main": [
[
{
"node": "Ignore Locations w/o Sales",
"type": "main",
"index": 0
}
]
]
},
"Turn Locations Into List": {
"main": [
[
{
"node": "Get Sales from Square",
"type": "main",
"index": 0
}
]
]
},
"Ignore Locations w/o Sales": {
"main": [
[
{
"node": "Compile Sales Reports",
"type": "main",
"index": 0
}
]
]
},
"Convert Sales Summary to CSV File": {
"main": [
[
{
"node": "Send Report",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2httpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow automatically connects to the Square API and generates a daily sales summary report for all your Square locations. The report matches the figures displayed in Square Dashboard > Reports > Sales Summary.
Source: https://n8n.io/workflows/6460/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
YOUR_ID 4. Uses gmail, googleDrive, googleSheets, httpRequest. Scheduled trigger; 53 nodes.
Instead of providing a routine check, it focuses on significant movements by: Sending a Slack alert only if a query crosses a defined movement threshold. Emailing a structured report with the Top 25 i
Looking for a way to track GitHub bounty issues automatically and get notified in real time? This GitHub Bounty Tracker workflow monitors repositories for issues labeled 💎 Bounty, logs them in Google
This workflow automatically sends a beautifully designed HTML newsletter every Sunday at 8 AM, featuring products currently on sale from your Algolia-powered e-commerce store.
This workflow automatically identifies your weekly bestselling product from your Algolia-powered e-commerce store and generates a cinematic product video using Google VEO 3.0 AI, helping marketing tea