Rename generated spreadsheet file before sending it as attachment with E-Mail node

Hi there,

maybe I did not yet fully understand the nodes, but I would really like to rename the file that is generated by the spreadsheet-node before I send it as an attachment out via e-mail (currently it’s named spreadsheet.csv):

{
  "nodes": [
    {
      "parameters": {
        "operation": "toFile",
        "fileFormat": "csv"
      },
      "name": "Convert to XLS",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        930,
        310
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "fromEmail": "fromEmail",
        "toEmail": "toEmail",
        "ccEmail": "ccEmail",
        "subject": "subject",
        "attachments": "data",
        "options": {}
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 1,
      "position": [
        1310,
        370
      ],
      "credentials": {
        "smtp": "smtpCredentials"
      }
    },
    {
      "parameters": {
        "mode": "mergeByIndex"
      },
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "position": [
        1120,
        370
      ]
    }
  ],
  "connections": {
    "Convert to XLS": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Is there any chance i can do this? Am I missing something?

You are right! I really have to add an option to the node to set a custom file name. For now, you can rename it with the Function-Node like this:

Released [email protected] which now allows setting a custom file name.

You are amazing! This is really handy in terms of accessibility.

Regarding renaming: It would be nice to have a bit better documentation for the FunctionItem and Function Nodes, maybe then it would have been a bit more obvious. (i.e. how do you pass the datastructures around, how can they be manipulated and returned properly, that everything works properly)

Yes, totally agree! That is sadly one of many things I have on my to-do list for a very long time but sadly never get to it as there is way to much other stuff to do. I hope I am able to get at least something basic written soon!

So if I understand correctly, each item-node has a .json and a .binary property which contains an object which I’m able to manipulate. If that is what it comes down to, that would be sufficient to know.

Yes that is generally true. Only the binary object is a little bit more complicated. But like written in the Github issue did I start with the documentation this morning. Hope to find some time again later today or tomorrow to finish and upload it soon.
Then everything will hopefully be clearer and easier for everybody.

Ok created now some documentation.

Information about the data-structure, in general, can be found here:

Information about the Function-Nodes here:

Hope it makes things a little bit clearer.

1 Like