Hello community! How can I find out the row number in GoogleTable if I know the key (“uuid”) unique identifier of the row?
Hey @Roket,
You can use the following code snippet
const uuid = 2;
const rowNumber = items.findIndex(i=> i.json['uuid']===uuid)+2;
console.log(rowNumber);
return [{json:{rowNumber}}];
You will have to update the value for uuid
. This can be the uuid you want to return the row number for.
Also, you can notice that I am adding the returned value with 2. The reason for this is that since it is an array, it starts with the index 0 (your first row becomes 0, the second row becomes 1, and so on). The first row in your sheet contains the column names, hence we need to consider that value as well.
I hope this is helpful.
@harshil1712, hey! No, it didn’t work, but I’m doing other tasks now, so I didn’t focus on this problem (I solved this problem differently). No help needed at this time, thanks.
Thanks for letting me know. If you can share your solution that would be wonderful! It will help others with the same issue find the solution faster
Ok, but my solution is outside of n8n). I made a fixed line ordering structure on the input, so the problem disappeared by itself.