Need help with HTTP request + spreadsheet parse

Describe the issue/error/question

Through a PostgreSQL SELECT query (represented as a Set node in the example), I get a list of CSV files to download:

[
    {
        "id": 10,
        "url": "https://gist.githubusercontent.com/netj/8836201/raw/6f9306ad21398ea43cba4f7d537619d0e07d5ae3/iris.csv"
    },
    {
        "id": 20,
        "url": "https://raw.githubusercontent.com/ywchiu/riii/master/data/house-prices.csv"
    }
]

I want to get the parsed CSV files associated with their respective “id” (from the database), e.g.:

[
  {
    "id": 10,
    "sepal.length": 5.1,
    "sepal.width": 3.5,
    "petal.length": 1.4,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "id": 10,
    "sepal.length": 4.9,
    "sepal.width": 3,
    "petal.length": 1.4,
    "petal.width": 0.2,
    "variety": "Setosa"
  },

Sadly, I wasn’t able to get an output like that :frowning: While the HTTP request doesn’t discard the Postgre query results, once I run the Spreadsheet node those are lost from the output object. I’ve also played with Merge but wasn’t able to get it right, so I would appreciate if you provide me a working example :slight_smile:

Please share the workflow

Share the output returned by the last node

[
  {
    "sepal.length": 5.1,
    "sepal.width": 3.5,
    "petal.length": 1.4,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.9,
    "sepal.width": 3,
    "petal.length": 1.4,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.7,
    "sepal.width": 3.2,
    "petal.length": 1.3,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.6,
    "sepal.width": 3.1,
    "petal.length": 1.5,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5,
    "sepal.width": 3.6,
    "petal.length": 1.4,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.4,
    "sepal.width": 3.9,
    "petal.length": 1.7,
    "petal.width": 0.4,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.6,
    "sepal.width": 3.4,
    "petal.length": 1.4,
    "petal.width": 0.3,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5,
    "sepal.width": 3.4,
    "petal.length": 1.5,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.4,
    "sepal.width": 2.9,
    "petal.length": 1.4,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.9,
    "sepal.width": 3.1,
    "petal.length": 1.5,
    "petal.width": 0.1,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.4,
    "sepal.width": 3.7,
    "petal.length": 1.5,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.8,
    "sepal.width": 3.4,
    "petal.length": 1.6,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.8,
    "sepal.width": 3,
    "petal.length": 1.4,
    "petal.width": 0.1,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.3,
    "sepal.width": 3,
    "petal.length": 1.1,
    "petal.width": 0.1,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.8,
    "sepal.width": 4,
    "petal.length": 1.2,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.7,
    "sepal.width": 4.4,
    "petal.length": 1.5,
    "petal.width": 0.4,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.4,
    "sepal.width": 3.9,
    "petal.length": 1.3,
    "petal.width": 0.4,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.1,
    "sepal.width": 3.5,
    "petal.length": 1.4,
    "petal.width": 0.3,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.7,
    "sepal.width": 3.8,
    "petal.length": 1.7,
    "petal.width": 0.3,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.1,
    "sepal.width": 3.8,
    "petal.length": 1.5,
    "petal.width": 0.3,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.4,
    "sepal.width": 3.4,
    "petal.length": 1.7,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.1,
    "sepal.width": 3.7,
    "petal.length": 1.5,
    "petal.width": 0.4,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.6,
    "sepal.width": 3.6,
    "petal.length": 1,
    "petal.width": 0.2,
    "variety": "Setosa"
  },
  {
    "sepal.length": 5.1,
    "sepal.width": 3.3,
    "petal.length": 1.7,
    "petal.width": 0.5,
    "variety": "Setosa"
  },
  {
    "sepal.length": 4.8,
    "sepal.width": 3.4,
    "petal.length": 1.9,
    "petal.width": 0.2,
    "variety": "Setosa"
  }
]
// (...)

Information on your n8n setup

  • n8n version: 0.165.1
  • Database you’re using (default: SQLite): PostgreSQL
  • Running n8n with the execution process [own(default), main]: ?
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @fishnux, a possible approach would be to split the Execution into batches of one. Then you can simply multiplex the respective ID from the HTTP Request node with each element coming from the Spreadsheet File node using the Merge node.

Here’s a quick example workflow showing the idea:

Example Workflow

The last Function node (“Merge Executions”) is not needed (unless you for example want to write the results in a single spreadsheet or something), I’ve included it just in case :wink:

Hope this helps! Let me know if you have any questions on this.