Here’s the workflow.
{
"nodes": [
{
"parameters": {
"authentication": "headerAuth",
"url": "=https://api.smartsheet.com/2.0/sheets/{{$json[\"SheetID\"]}}",
"options": {
"splitIntoItems": false
},
"queryParametersUi": {
"parameter": [
{
"name": "columnIds",
"value": "={{$json[\"columnIds\"]}}"
}
]
}
},
"name": "SS Get Sheet",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
40,
-600
],
"credentials": {
"httpHeaderAuth": "Smartsheet Integromat"
}
},
{
"parameters": {
"authentication": "headerAuth",
"requestMethod": "DELETE",
"url": "=https://api.smartsheet.com/2.0/sheets/{{$item(0).$node[\"SS - Set Sheet ID\"].json[\"SheetID\"]}}/rows?ids={{$json[\"therows\"]}}&ignoreRowsNotFound=true",
"jsonParameters": true,
"options": {}
},
"name": "SS Delete Rows1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1270,
-430
],
"credentials": {
"httpHeaderAuth": "Smartsheet"
}
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1250,
-600
]
},
{
"parameters": {
"batchSize": 50,
"options": {
"reset": false
}
},
"name": "SplitInBatches",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
430,
-600
],
"alwaysOutputData": true
},
{
"parameters": {
"functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n\n// Loop over inputs and add a new field called 'myNewField' to the JSON of each one\nconst newItems = [];\n\nfor (const element of items[0].json.rows) {\n newItems.push({json:element});\n}\n\n// const theData = newItems.map(element => ({ json: element }))\n\nreturn newItems;\n"
},
"name": "Transform JSON to Row IDs Only2",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
240,
-600
],
"alwaysOutputData": true
},
{
"parameters": {
"functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n\nreturn [\n {\n json: {\n therows: items.map(e => e.json.id).join(',')\n },\n }\n]\n"
},
"name": "Convert ID's to Comma String2",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
640,
-600
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"therows\"]}}",
"operation": "isEmpty"
}
]
}
},
"name": "Test Empty2",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
870,
-600
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "SheetID",
"value": "123456789"
},
{
"name": "columnIds",
"value": "968346995844996"
}
],
"number": []
},
"options": {}
},
"name": "SS - Set Sheet ID",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-150,
-600
],
"alwaysOutputData": true
},
{
"parameters": {
"values": {
"string": [
{
"name": "SheetID",
"value": "={{$node[\"SS - Set Sheet ID\"].json[\"SheetID\"]}}"
}
],
"number": []
},
"options": {}
},
"name": "SS - Set Sheet ID1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1070,
-430
],
"alwaysOutputData": true
},
{
"parameters": {
"path": "72927bb8-2368-488f-9bfc",
"options": {}
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
-430,
-600
],
"webhookId": "72927bb8-",
"disabled": false
}
],
"connections": {
"SS Get Sheet": {
"main": [
[
{
"node": "Transform JSON to Row IDs Only2",
"type": "main",
"index": 0
}
]
]
},
"SS Delete Rows1": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "Convert ID's to Comma String2",
"type": "main",
"index": 0
}
]
]
},
"Transform JSON to Row IDs Only2": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"Convert ID's to Comma String2": {
"main": [
[
{
"node": "Test Empty2",
"type": "main",
"index": 0
}
]
]
},
"Test Empty2": {
"main": [
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
],
[
{
"node": "SS - Set Sheet ID1",
"type": "main",
"index": 0
}
]
]
},
"SS - Set Sheet ID": {
"main": [
[
{
"node": "SS Get Sheet",
"type": "main",
"index": 0
}
]
]
},
"SS - Set Sheet ID1": {
"main": [
[
{
"node": "SS Delete Rows1",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "SS - Set Sheet ID",
"type": "main",
"index": 0
}
]
]
}
}
}