Hi everyone,
I’m building a workflow where:
Gmail Trigger → Set (Flatten Email) → Merge with Google Sheets → IF (check status) → Google Drive + Update Sheet.
The issue:
In the Set node, when I extract the From field, the value always has \n characters at the end (example: [email protected]\n).
Because of this, the Merge node fails when I try to match the Gmail sender email to the Google Sheets Email column (the values don’t line up).
Here’s what I’ve already tried:
Using .trim(), .replace(/\n/g, “”), .replace(/\s+/g, “”), etc.
Rebuilding the entire workflow from scratch.
Switching between raw Gmail output and simplified mode.
Using payload.headers.find(h => h.name === “From”).value to extract email.
No matter what I try, the /n still shows up in the Set node output (both JSON and Table view).
Questions:
Is this a bug with how Gmail Trigger sends data to n8n?
Is there a reliable way to completely strip \n (newlines) from the Gmail “From” field?
Should I be cleaning this in the Set node, or do I need a Function node instead?
Any advice (or working expression!) would be hugely appreciated, because this /n issue is stopping the Merge node from ever matching emails correctly.
Thanks!
What is the error message (if any)?
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
