Repetitive tasks eat hours every week. Downloading a report, cleaning it in Excel, emailing it to five people — done manually, it is a chore. Done with n8n and Python, it runs itself. Here is how I set up my first automated data pipeline.
What is n8n?
n8n is an open-source workflow automation tool — think of it as a visual canvas where you connect nodes (triggers, actions, transformations) to build automated pipelines without writing a single line of code for the basic flows. It supports over 400 integrations: Google Sheets, Gmail, Slack, HTTP requests, databases, and more.
The best part? You can drop in a Python or JavaScript node anywhere in the workflow for custom logic — making it incredibly powerful when combined with your existing scripts.
The Problem I Wanted to Solve
Every Monday morning I was manually:
- Pulling sales data from a Google Sheet
- Running a Python script to clean and summarise it
- Pasting the summary into an email and sending it to the team
Three steps, 20 minutes, every single week. The perfect candidate for automation.
Building the Workflow
Here is the flow I built in n8n — four nodes, end to end:
import pandas as pd
# Data comes in from the Google Sheets node
data = items[0]['json']['values']
df = pd.DataFrame(data[1:], columns=data[0])
# Clean and summarise
df['Revenue'] = pd.to_numeric(df['Revenue'], errors='coerce')
total = df['Revenue'].sum()
average = df['Revenue'].mean()
top = df.nlargest(3, 'Revenue')['Product'].tolist()
return [{'json': {
'total': total,
'average': round(average, 2),
'top': top,
}}]
Node 1 — Schedule Trigger
Set to fire every Monday at 8:00 AM. No manual trigger needed — the workflow wakes itself up.
Node 2 — Google Sheets
Reads the latest data from the spreadsheet using the Google Sheets node. Requires a Google OAuth credential set up once in n8n settings.
Node 3 — Python Code Node
The script above runs inside n8n. It cleans the data with pandas, calculates totals and averages, and returns a clean JSON summary.
Node 4 — Gmail
Takes the summary from Node 3 and sends a formatted email to the team. The body is built with an expression like:
Weekly Sales Summary
Total Revenue : ${{ $json.total }}
Average Sale : ${{ $json.average }}
Top Products : {{ $json.top.join(', ') }}
Sent automatically by n8n.
The Result
The workflow runs every Monday at 8 AM, takes about 4 seconds, and the team receives the email before they open their laptops. 20 minutes saved every week — that is over 17 hours a year from one small automation.
Key Takeaways
- Start small — pick one repetitive task and automate just that.
- n8n + Python is a powerful combination: visual flow for the plumbing, Python for the logic.
- Schedule triggers are the simplest way to run automations hands-free.
- Once the pattern clicks, you will find automatable tasks everywhere.