Hello everyone,
I have a workflow tasked with processing a list of records contained in a CSV file with this structure (header and data):
sku --> header
SKU1; --> data
SKU2; --> data
output convertToCSV :
[
{
"sku": "SKU1"
},
{
"sku": "SKU2"
}
]
With a loop, each line of the file is saved in an external database, then another node adds information collected upstream of the CSV reading node, adds data obtained through an API call. This gives a JSON with this structure:
Fist iteration :
[
{
"name": "image_hd_01",
"value": "7/f/5/9/7f592403068ab3e002b6a4ad1f8d545fb0ce960b_sku1_1.jpg",
"sku": "SKU1",
"rowid": "ro_ta_b9765384c9df45a98663767176a4c1ee_08e6dfec73b74bd3b7a57c0cbd9cf732"
},
{
"name": "image_web_01",
"value": "1/6/c/0/16c0ca6d4a672f66e5d255cbc76cd88aada4ed76_sku1_1.jpg",
"sku": "SKU1",
"rowid": "ro_ta_b9765384c9df45a98663767176a4c1ee_08e6dfec73b74bd3b7a57c0cbd9cf732"
}
]
Second iteration:
[
{
"name": "image_hd_01",
"value": "a/d/b/2/adb276b7c2ab98ad60efaf3f27251755473d9d49_300DPI_2000px_sku2.jpg",
"sku": "SKU2",
"rowid": "ro_ta_b9765384c9df45a98663767176a4c1ee_8b2c580ba29c467a844170b3b0786d60"
}
]
output “loopInsertSKU”:
1 iteration in loop branch :
[
{
"sku": "SKU1"
}
]
2 iteration in loop branch :
[
{
"sku": "SKU2"
}
]
Last iteration in done branch:
[
{
"data": {
"_id": "ro_ta_b9765384c9df45a98663767176a4c1ee_08e6dfec73b74bd3b7a57c0cbd9cf732",
"sku": "SKU1",
"tableId": "ta_b9765384c9df45a98663767176a4c1ee",
"type": "row",
"createdAt": "2026-05-19T15:24:32.228Z",
"updatedAt": "2026-05-19T15:24:32.228Z",
"image_hd_01": "7/f/5/9/7f592403068ab3e002b6a4ad1f8d545fb0ce960b_SKU1_1.jpg",
"image_hd_01_filename": "SKU1-1.jpg"
}
},
{
"data": {
"_id": "ro_ta_b9765384c9df45a98663767176a4c1ee_08e6dfec73b74bd3b7a57c0cbd9cf732",
"sku": "SKU1",
"tableId": "ta_b9765384c9df45a98663767176a4c1ee",
"type": "row",
"createdAt": "2026-05-19T15:24:32.228Z",
"updatedAt": "2026-05-19T15:24:32.228Z",
"image_hd_01": "7/f/5/9/7f592403068ab3e002b6a4ad1f8d545fb0ce960b_SKU1_1.jpg",
"image_hd_01_filename": "SKU1-1.jpg"
}
},
/// Why doesn't this part have the same structure as the rest? ///
{
"name": "image_hd_01",
"value": "a/d/b/2/adb276b7c2ab98ad60efaf3f27251755473d9d49_300DPI_2000px_SKU2.jpg",
"sku": "SKU1",
"rowid": "ro_ta_b9765384c9df45a98663767176a4c1ee_8b2c580ba29c467a844170b3b0786d60"
}
]
Then another loop is launched to make another API call and save additional data in the external database. The CSV reading, saving the rows in the database, and collecting from the APIs are working fine. But the second loop is not being handled correctly in the case of a CSV file with multiple lines. The first line of the CSV is processed correctly but the second one is not, and for example, the data collected in the second loop are not in the loop branch but in the done branch.
1 iteration in “Loop Over Items1” in loop branch:
[
{
"name": "image_hd_01",
"value": "7/f/5/9/7f592403068ab3e002b6a4ad1f8d545fb0ce960b_SKU1_1.jpg",
"sku": "SKU1",
"rowid": "ro_ta_b9765384c9df45a98663767176a4c1ee_08e6dfec73b74bd3b7a57c0cbd9cf732"
}
]
2 iteration in “Loop over items1” in done branch (?)
[
{
"data": {
"_id": "ro_ta_b9765384c9df45a98663767176a4c1ee_08e6dfec73b74bd3b7a57c0cbd9cf732",
"sku": "SKU1",
"tableId": "ta_b9765384c9df45a98663767176a4c1ee",
"type": "row",
"createdAt": "2026-05-19T15:24:32.228Z",
"updatedAt": "2026-05-19T15:24:32.228Z",
"image_hd_01": "7/f/5/9/7f592403068ab3e002b6a4ad1f8d545fb0ce960b_SKU1_1.jpg",
"image_hd_01_filename": "SKU1-1.jpg"
}
}
]
Last iteration in “Loop over items1” in done branch:
[
{
"data": {
"_id": "ro_ta_b9765384c9df45a98663767176a4c1ee_08e6dfec73b74bd3b7a57c0cbd9cf732",
"sku": "SKU1,
"tableId": "ta_b9765384c9df45a98663767176a4c1ee",
"type": "row",
"createdAt": "2026-05-19T15:24:32.228Z",
"updatedAt": "2026-05-19T15:24:32.228Z",
"image_hd_01": "7/f/5/9/7f592403068ab3e002b6a4ad1f8d545fb0ce960b_SKU1_1.jpg",
"image_hd_01_filename": "SKU1-1.jpg"
}
},
/// Why doesn't this part have the same structure as the rest? ///
{
"name": "image_hd_01",
"value": "a/d/b/2/adb276b7c2ab98ad60efaf3f27251755473d9d49_300DPI_2000px_SKU2.jpg",
"sku": "SKU2",
"rowid": "ro_ta_b9765384c9df45a98663767176a4c1ee_8b2c580ba29c467a844170b3b0786d60"
}
]
Please share your workflow
Information on your n8n setup
- n8n version: 2.20.9
- Database : SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via : Docker
- Operating system: Linux