How can I loop through the rows of a spreadsheet?

Hi, I’m trying to read a CSV and for each line of the CSV check to see if there is a valid URL in a given column then based off of that fire off a HTTP request. What’s the best way to achieve this? (also is there any way that I might be able to make this work in parallel?)

Assuming the CSV is coming from the HTTP request node, the example below might help.

Basically, you just need the node that retrieves the CSV file, and an IF node to check whether the input has a valid URL, and finally an HTTP request node referencing the valid URLs.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://sample-videos.com/csv/Sample-Spreadsheet-10-rows.csv",
        "responseFormat": "file",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        560,
        300
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 1,
      "position": [
        800,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$node[\"Spreadsheet File\"].json[\"Storage & Organization\"]}}",
              "value2": "Appliances"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1030,
        300
      ]
    },
    {
      "parameters": {},
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1260,
        460
      ]
    },
    {
      "parameters": {
        "url": "asasas",
        "options": {}
      },
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1290,
        170
      ],
      "notesInFlow": true,
      "notes": "Make an HTTP Request"
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like

Did it work?

@RicardoE105 I ended up doing a split in batch with an if and it seemed to work without any extra configuration