I use the webhook to get the data and write it to the google sheet.
I want to add only new documents to avoid duplication of old content
You can see pictures.
Here is my code
const new_items = $node["Extract data"].json["link"];
var new_items1 = [];
const data = $node["Google Sheets1"].json["link"];
//data.link = data.link || [];
for (let i = new_items.length - 1; i >= 0; i--) {
// Check if data is already present
if (data.includes(new_items[i])) {
break;
} else {
// if new data then add it to an array
new_items1.push({
json: {
link: new_items[i],
},
});
}
}
return new_items1;
I am not getting output