#Help only I am trying to download a .csv file from Server 1 and Sending it to Server 2 but Server2 receiving only empty csv file

Can someone guide why my HTTP node is sending empty CSV file to my server even though received 4006 entries from server 1

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -280,
        -1820
      ]
    },
    {
      "parameters": {
        "url": "=https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/{{$json[\"date\"]}}.csv",
        "responseFormat": "file",
        "options": {},
        "headerParametersUi": {
          "parameter": []
        },
        "queryParametersUi": {
          "parameter": []
        }
      },
      "name": "Fetch Script1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        -1820
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "toFile",
        "fileFormat": "csv",
        "options": {
          "fileName": "datafile.csv"
        }
      },
      "name": "Spreadsheet File1",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        520,
        -1780
      ],
      "executeOnce": false
    },
    {
      "parameters": {
        "functionCode": "\nconst date = new Date(new Date().setDate(new Date().getDate() - 1)).toISOString().split(\"T\")[0].split(\"-\");\nitem.date = `${date[1]}-${date[2]}-${date[0]}`;\nreturn item;"
      },
      "name": "Get Date1",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        -80,
        -1820
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "={{$node[\"Set19\"].parameter[\"values\"][\"string\"][0][\"value\"]}}/files",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "multipart-form-data"
        },
        "sendBinaryData": true,
        "headerParametersJson": "={\n\"Authorization\": \"Bearer {{$item(0).$node[\"HTTP Request29\"].json[\"data\"][\"access_token\"]}}\"\n}"
      },
      "name": "HTTP Request4",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        780,
        -1780
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Spreadsheet File2",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        520,
        -1980
      ],
      "executeOnce": false
    },
    {
      "parameters": {
        "values": {
          "boolean": [],
          "string": [
            {
              "name": "url",
              "value": "https://localhost:8080"
            }
          ]
        },
        "options": {}
      },
      "name": "Set19",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        0,
        -2020
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Get Date1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set19",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Script1": {
      "main": [
        [
          {
            "node": "Spreadsheet File1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Spreadsheet File2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File1": {
      "main": [
        [
          {
            "node": "HTTP Request4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Date1": {
      "main": [
        [
          {
            "node": "Fetch Script1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

In the HTTP Request4 node, in the binary data parameter, can you try doing file:data instead of data?

Thanks. It worked for me after i added like below. Don’t know whether it is a right method but it is working fine as of today

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "name": "Spreadsheet File99",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        -880,
        400
      ],
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "operation": "toFile",
        "fileFormat": "csv",
        "options": {
          "fileName": "=test.csv"
        }
      },
      "name": "Spreadsheet File1010",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        -700,
        400
      ]
    }
  ],
  "connections": {
    "Spreadsheet File99": {
      "main": [
        [
          {
            "node": "Spreadsheet File1010",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
2 Likes

Glad to hear this approach is working for you, many thanks for confirming!