How to send multiple JSON results in one mail in table

How can I send multiple JSON results in one email as a table?
I have a feature that filters my JSON and prepares data for one user.
[1 screen]
Then I want to send them together (all JSON results) as a table in one email.
If I use a standard parameter mark with JSON it sends a separate e-mail for each item.
[2 screen]
I try to achieve something like this:
[on the right]

Welcome to the community @rafuru!

Not sure if I understand exactly what you want to do but here a workflow which does how I understand it:

{
  "nodes": [
    {
      "parameters": {
        "operation": "toFile",
        "options": {}
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        1050,
        350
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      domain: 'example1.com',\n      parameter1: 'a1',\n      parameter2: 'b1',\n    }\n  },\n  {\n    json: {\n      domain: 'example2.com',\n      parameter1: 'a2',\n      parameter2: 'b2',\n    }\n  }\n];"
      },
      "name": "Mock Data",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        850,
        350
      ]
    },
    {
      "parameters": {
        "fromEmail": "[email protected]",
        "toEmail": "[email protected]",
        "subject": "Spreadsheet",
        "attachments": "data",
        "options": {}
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1250,
        350
      ]
    }
  ],
  "connections": {
    "Spreadsheet File": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mock Data": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hi @jan ,

What I want to achieve is to send data from JSON (multiple results [rows from sheet]) in a tabular form in an e-mail. Not as an attachment but as HTML content.
Something like that:
obraz

Is this even possible?

hm theoretically yes but for sure quite complicated with the Send EMail Node. For it to work you would have to build the HTML in a Function-Node.

Should be easier with something like AWS SES and then “Send Template” but do not have much experience there.

@jan

The thread can be considered closed.
I solved this by using Google Sheets where I perform data transformations and download to node a ready-made HTML code, which I put into email node.

Ah great to hear that you found a solution that works for you! Have fun!

1 Like