I guess, I am just not getting it but just to be on the same page:
I have a perfectly nice looking result in “spreadsheet node”. I am not able to pass that to Httprequest as base64.
This is the snippet of what I am trying, and it doesn’t work.
{
"nodes": [
{
"parameters": {
"operation": "toFile",
"options": {}
},
"name": "Spreadsheet File",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
1100,
-290
]
},
{
"parameters": {
"functionCode": "const data = []\n\nfor (const item of items) {\n data.push(item.json)\n}\n\nconst dataBase64 = Buffer.from(JSON.stringify(data)).toString('base64');\n\nreturn [\n {\n json: {\n dataBase64\n }\n }\n]\n\n"
},
"name": "Function1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1270,
-280
],
"notesInFlow": true,
"notes": "Base64 encoding"
},
{
"parameters": {
"requestMethod": "POST",
"url": "SOME SERVICE",
"options": {
"bodyContentType": "json",
"timeout": 300000
},
"bodyParametersUi": {
"parameter": [
{
"name": "base64",
"value": "={{$node[\"Function1\"].json[\"dataBase64\"]}}"
},
{
"name": "name",
"value": "somefile.xls"
},
{
"name": "UUU",
"value": "YYY"
},
{
"name": "XXX",
"value": "XYZ"
}
]
}
},
"name": "Upload List",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1480,
-300
]
}
],
"connections": {
"Spreadsheet File": {
"main": [
[
{
"node": "Function1",
"type": "main",
"index": 0
}
]
]
},
"Function1": {
"main": [
[
{
"node": "Upload List",
"type": "main",
"index": 0
}
]
]
}
}
}