Duplicate Google Sheets Data

Good afternoon Community n8n! How are you?

I wanted to ask you about an inconvenience that I am having when executing columns in Google Sheets. The problem is that when I get the data from a column, for example “Status” that has a dropdown with values ​​of: “Done” and “Pending” and in turn has other additional data in other columns, if I change the values ​​of Pending a Done from top to bottom copies the data correctly and then when I execute it again it tells me that there is no value with pending. Now, in the opposite case, if I change the values ​​of Pending from bottom to top to Done, the information is duplicated, even though I already have it copied correctly and with the Done field, it is as if the if omitted it.

Workflow:

Regards!!

Hi @Internalit_Automatio, I am sorry to hear you’re having trouble here!

From looking at your screenshot I don’t think I fully understand your workflow I am afraid. Where exactly is the duplication happening? Can you share the respective part of your workflow?

Hi @MutedJam !! thanks for your help! I don’t know how to share the Workflow but I will try to explain myself as best as possible.

I have 3 Google Sheets spreadsheets.

  1. IT-Test: it is where the user data that the tickets are created, which is copied from the “Users” spreadsheet, as a history.
  2. Users: This contains all the information of the new user that enters, where there is a column that says “Status” that if the person enters, “Done” is placed and the WorkFlow begins and if they have not entered yet, “Pending” is left ", and the Workflow is not executed.
  3. Tickets: here it takes the data from the “Users” form so that the ticket is generated and as it is generated, it deletes it.

In the first IF I compare the “Status” column of the Users spreadsheet, if it is “Done” it goes to the next IF and if there is no Done, it does nothing.

In the second IF I compare the ID of the person who brings me from the “Users” spreadsheet with “IT-List” which is so that the ticket is not duplicated in JIRA Software, if the ID is not found it makes a copy in the spreadsheet “IT-List” and “Tickets”.

If, for example, in the “Users” spreadsheet I have 10 new users, and I place the “Done” from top to bottom, for example: I put Done to User 1, 3, 5, 7, 10, (first I put Done to 1, it does the process, then to 2 and so on) the worfklow does it correctly, since when I run it again after the whole process it detects that those Users are already in “IT-List” and it does nothing.
Now if I put the Done to User 10 it does it well, if I add user 7, it copies user 10 and 7 again. If I add user 5 again, it copies user 10, 7, 5 again, so there in the IT-List spreadsheet I already have user 10 copied 3 times and user 7 twice, like the IF of comparing ID it doesn’t if I start from the bottom up.

Hey @Internalit_Automatio, you can share your workflow by simply selecting the nodes you want to share on your canvas, pressing Ctrl+C and then inserting the code here on the forum using the snippet feature. There should also be a link with more information right above the text field:
image

Now if I put the Done to User 10 it does it well, if I add user 7, it copies user 10 and 7 again. If I add user 5 again, it copies user 10, 7, 5 again, so there in the IT-List spreadsheet I already have user 10 copied 3 times and user 7 twice, like the IF of comparing ID it doesn’t if I start from the bottom up.

So if you want each user ID only once in a sheet, you might want to use the Create or Update operation of the Google Sheets node (instead of the Append operation which would write new data to your sheet regardless):

image

Hey @MutedJam

It works correctly now with “Create and update” it doesn’t duplicate it in the IT-List spreadsheet!!!, and I ask you a question, For example, when the entire workflow ends, fill a column with a value so that it does not generate a ticket again in this case

1 Like

Awesome, I am really glad to hear that :smiling_face:

Adding an additional value could be done by first adding an additional column to your Google Sheet (for example “Processed”). Then add a Set node writing a value in the “Processed” field like so:

This example will write a timestamp in the “Processed” field, but that could of course be anything else that works for you.

You can then use an IF node in your workflows to check if the Processed column has a non-empty value after reading your sheet. If so, you know your row has already been processed (and your item would be sent to the “true” output of the IF node"). If not your item would go the the “false” output and you know it would need processing.

1 Like